This is a very simple problem,but I cannot figure out what I'm missing. I made a mySQL database (let's say DatabaseX) with a table (TableY). When I go into mySQL and run an insert on TableY, it works fine. However, I'm still a PHP beginner, and I'm trying to get my INSERT to work off of a form. I submit my form, and the action page runs fine showing me no errors. But when I query my table in mySQL there are no records, so I know the INSERT didn't work. HELP! Without errors I have no idea where the miscommunication is happening.....
My simplified PHP code:
$qSQL = "";
$qSQL = $qSQL . "INSERT INTO TableY ";
$qSQL = $qSQL . "(sCol1) VALUE ('hi')";
echo $qSQL; //This prints out fine
$db = mysql_connect("localhost", "user", "password");
mysql_select_db("DatabaseX",$db);
$result = mysql_query($qSQL);
echo $qSQL; //This prints out fine so the page gets here.
My simplified PHP code:
$qSQL = "";
$qSQL = $qSQL . "INSERT INTO TableY ";
$qSQL = $qSQL . "(sCol1) VALUE ('hi')";
echo $qSQL; //This prints out fine
$db = mysql_connect("localhost", "user", "password");
mysql_select_db("DatabaseX",$db);
$result = mysql_query($qSQL);
echo $qSQL; //This prints out fine so the page gets here.