Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MythicFrost

macrumors 68040
Original poster
Mar 11, 2009
3,944
40
Australia
Hi,

I'm trying to do this:
Code:
$sqlAdd[$i] = "INSERT INTO ct_".$country." (name, url) VALUES (test3, test)";
if (!mysql_query(mysql_real_escape_string($sqlAdd[$i]), $con)) {
    die('Error: ' . mysql_error());
}

(adding into the table ct_int in the field name and url rows, the values test3 and test)

The error I get is:
Error: Unknown column 'test3' in 'field list'
How come its looking for column "test" it should be looking for the column "name"? What's up with that ey?

Kind Regards
 
Values should be strings, which need to be quoted.

PHP:
$sqlAdd[$i] = "INSERT INTO ct_".$country." (name, url) VALUES ('test3', 'test')";

which will put "test3" into column name, and "test" into column url.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.