...

View Full Version : format for php variable in select statement?



chingching
06-04-2007, 07:00 AM
Hello I have a formatting problem.

I have an mysql select statement which works fine:

// good $sql = 'SELECT * FROM `country` WHERE `country_3_code` = CONVERT(_utf8 \'usa\' USING latin1) COLLATE latin1_swedish_ci';

I would like to put a php variable where "usa" is now.

I have a variable = usa called $xx

I cannot get it to work, i have tried single quotes, double quotes, back quotes, no quotes, etc.

Plz help. Thank you.

maghiel
06-04-2007, 10:52 AM
Hello I have a formatting problem.

I have an mysql select statement which works fine:

// good $sql = 'SELECT * FROM `country` WHERE `country_3_code` = CONVERT(_utf8 \'usa\' USING latin1) COLLATE latin1_swedish_ci';

I would like to put a php variable where "usa" is now.

I have a variable = usa called $xx

I cannot get it to work, i have tried single quotes, double quotes, back quotes, no quotes, etc.

Plz help. Thank you.



$sql = 'SELECT * FROM `country` WHERE `country_3_code` = CONVERT(_utf8 \'' . $xx . '\' USING latin1) COLLATE latin1_swedish_ci';



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum