embeding PHP variable in mysql_query

Hi

I am trying to create a table using mesql_query to create table and name it with a number generated by a PHP random variable.

$status = mysql_select_db($database);

$var= $_COOKIE['randid'];

mysql_query(" CREATE TABLE {$var} VALUES (
userid_id bigint(255))");

I thought there must be a problem with the type of value stored in the cookie as its an INT but it wasnt the right solution i have changed it to a string but im not yet able to create the table.

the generated number is a customer ID

Please help,

try this

$query = “create table " . $var . " values(userid_id bigint(225))”;
mysql_query($query);

Sponsor our Newsletter | Privacy Policy | Terms of Service