|
Posted by max on 08/14/05 16:48
First off, thanks for your patience.
>The . operator is to connect two strings: "test1"."test2" becomes "test1test2"
Of course! How dim can I get?
>
>> $TableName=rand(12345, 99999);
>> // which I thought would create $TableName with the value from the rand()
>
>Yes it does. But notice that you could have collisions. Imagine you get the random number
>20000 and you got it already? You already have the table!
No, in my clumsy kludgey way, I wanted to avoid possible collisions by
creating tables at random (I could always increase the seed range
enormously) while input is made, this is sent back to the user to verify
and, upon verification, the data is dumped into the table proper and the
rand-generated table dropped.
>
>> $Query = 'CREATE TABLE $TableName ('
>> . ' `id` SMALLINT(3) NOT NULL AUTO_INCREMENT, '
>> . ' `firstname` VARCHAR(255) NOT NULL,'
>> . ' PRIMARY KEY (`id`)'
>> . ' )';
>
>That looks right, but use " instead of ' instead and PHP will replace $TableName inside
>the string with the content of the variable $TableName. ' doesn't.
If you mean -
$Query = "CREATE TABLE $TableName ('
.. ' `id` SMALLINT(3) NOT NULL AUTO_INCREMENT, '
.. ' `firstname` VARCHAR(255) NOT NULL,'
.. ' PRIMARY KEY (`id`)'
.. ' )";
alas, that doesn't do it.
Navigation:
[Reply to this message]
|