Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MySQL Insert with PHP

Name: Anonymous 2010-12-17 11:05

I can't figure this out. Something is wrong with my SQL insert statement, and I have no idea what it is. (I also tried setting the variables for all of the values to be input, ie $city = "test" but that didn't work either...halp!)


<form method="POST" action="hw8b.php">
    Name:<br />
    <input type="text" name="name1" /><br /><br />
    City:<br />
    <input type="text" name="city" /><br /><br />
    Email:<br />
    <input type="text" name="email" /><br /><br />
    <input type="submit" value="Insert">
    </form>



<?php

$DBConnect = mysql_connect("localhost", "howard", "");

if (! $DBConnect)
{
  echo "<P>Database not available";
}

$_POST["howard"];
$_POST["password"];

$name1 = $_POST["name1"];
$city = $_POST["city"];;
$email = $_POST["email"];

mysql_select_db("myDB");

$SQLstring = "SELECT MAX(ID) FROM FANS";
$QueryResult = mysql_query($SQLstring);
$Row = mysql_fetch_row($QueryResult);
$fanID = $Row[0] + 1;

$SQLstring = "INSERT INTO FANS VALUES(" . $fanID . ",'" . $name1 . "','" . $city . "','" . $email . "');";

$QueryResult = mysql_query($SQLstring);

Name: Anonymous 2010-12-17 16:08


<?php

$DBConnect = mysql_connect("localhost", "howard", "");

if (! $DBConnect)
{
  echo "<P>Database not available";
}

$userID = $_POST["howard"];
$password = $_POST["password"];

$name1 = $_POST["name1"];
$city = $_POST["city"];;
$email = $_POST["email"];

mysql_select_db("myDB") or die(mysql_error());

$SQLstring = "SELECT MAX(FANID) FROM FANS" or die(mysql_error());
$QueryResult = mysql_query($SQLstring);
$Row = mysql_fetch_row($QueryResult);
$newID = $Row[0] + 1;

$SQLstring = "INSERT INTO FANS (FANID, NAME, CITY, EMAIL) VALUES ($newID,$name1,$city,$email);" or die(mysql_error());
$QueryResult = mysql_query($SQLstring);

mysql_close($DBConnect);

?>


The PHP page loads, doesn't output any errors...but it doesn't fucking INSERT THE GOD DAMN FORM DATA.
WHYYYYYYYYYYYYYYYYYYYYYYYYYYY

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List