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);