I'm trying to use an online form to enter information into a mySQL database. Some of my variables are making it into the database, some of them aren't. Here's my code:
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select
database $DBName");
$event = htmlspecialchars(addslashes($event));
$date = htmlspecialchars(addslashes($date));
$sponsor = htmlspecialchars(addslashes($sponsor));
$cosponsor = htmlspecialchars(addslashes($cosponsor));
$type = htmlspecialchars(addslashes($type));
$attendance = htmlspecialchars(addslashes($attendance));
$sqlquery = "INSERT INTO $table
VALUES('$event','$date','$sponsor','$cosponsor','type','attendance')";
$results = mysql_query($sqlquery);
mysql_close();
The cosponsor variable is not making it to the database and the attendance always shows up as 0. I've double checked my form code and everything seems to be right there. Any help would be appreciated!
Last edited by efriese on Sat Feb 21, 2004 1:26 pm, edited 1 time in total.
VALUES('$event','$date','$sponsor','$cosponsor','type','attendance')"; shouldn't that be ..
VALUES('$event','$date','$sponsor','$cosponsor','$type','$attendance')"; ?
Also put error_reporting(E_ALL); right after the first <?php in the script and echo $sqlquery before the mysql_query() line just to make sure it looks how you expect it to.