mh wrote:[color=blue]
> Hello,
>
> Andy Hassall a écrit :
>[color=green]
>>On 17 Jul 2005 09:42:34 -0700, "mh" <marchenri1@gmail.com> wrote:
>>
>>[color=darkred]
>>>$sql_query="CREATE TABLE '$num' ([/color]
>>
>> Don't put quotes around identifier names. If you must, then in MySQL use
>>either ` or ", but not '. ' is for strings, not identifiers.[/color]
>
> Ok, but I did that I think. I said in my message that I also tried like
> that:
> $sql_query = 'CREATE TABLE $num ('
> . ' `variable1` DATE NOT NULL'
> . ' )';
> In this case I don't use the quotes around the name of the table but
> MySQL still creates a table called $num and doesn't replace the
> variable $num but its value like I wish.
>
> I also tried:
> $sql_query="CREATE TABLE $num (variable DATE NOT NULL)";
> but without success.
> I feel that I tried every possible combiantion without success. There
> must be a solution. But what is it?
>[/color]
Look at strings in the PHP manual.
When enclosed in single quotes, variable substitution does NOT take place - so
your table name becomes $num.
When you enclose a string in double quotes, PHP will substitute variables. So
you should have something like:
$sql_query = "CREATE TABLE $num ("
^ ^
Note double quotes instead of single quotes. See
http://www.php.net/manual/en/language.variables.php.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================