Click to See Complete Forum and Search --> : [RESOLVED] "Unknown column test3 in field list" error in MySQL


Icyculyr
June 20th, 2010, 04:44 AM
Hi,

I'm trying to do this:

$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 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 "test3" it should be looking for the column "name"? What's up with that ey?

Kind Regards
EDIT: I fixed the above issue by calling mysql_query("SQL code") rather than putting it in the variable first... idk why that fixed it