I am trying to insert data into a MySQL 4.1.22 data base and the code I have used in the past on other servers isn't working. I am currently using PHP 5.2.8. The only way I have been able to make it work, is by using copied code from the PHP MyAdmin section in my cpanel. This copied code, has what appears to be slanted single quotes, but when replaced with regular single quotes it doesn't work. That is the only difference.
This code works:
This code does not work, but should:
Please help, I have racked my brain, but cannot figure out why it doesn't work and even though I could copy and past for the rest of my life, I would like to know what is going on.
Below is the full script that I am using:
The only error message I get is that there is an error near 'then it quotes the INSERT INTO section'.
Thanks!
This code works:
Code:
$sql="INSERT INTO $table1 (`UID`, `From`, `PostDate`, `FileName`, `FilePath`, `Time`)
VALUES ('$UID', '$from', '$postDate', '$DBfileName', '$filePath', NOW())";
Code:
$sql="INSERT INTO $table1 (UID, From, PostDate, FileName, FilePath, Time)
VALUES ('$UID', '$from', '$postDate', '$DBfileName', '$filePath', NOW())";
Below is the full script that I am using:
Code:
$con=mysql_connect("localhost",$user,$PW1);
if (!$con){
die('Could not connect: ' . mysql_error());
}mysql_select_db($DB1);
//Input data
$sql="INSERT INTO $table1 (UID, From, PostDate, FileName, FilePath, Time)
VALUES ('$UID', '$from', '$postDate', '$DBfileName', '$filePath', NOW())";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
Thanks!
Comment