CREATE TABLE $phpVariable_for_tableName <--- help please!

From: Date: Wed, 10 Mar 2004 07:11:02 +0000
Subject: CREATE TABLE $phpVariable_for_tableName <--- help please!
Groups: php.db 
Request: Send a blank email to php-db+get-33380@lists.php.net to get a copy of this message
i cant get this to work right, im building a comments for my blog. im pretty knowledgeable about php code and i am willing to listen, even though im still learning. my code in the php doc is as follows: 1 //select the db 2 $db = mysql_select_db($mydb) or die("db connect error"); 3 $newTable = $entryNum + "_comms"; 4 5 //if posting a comment do this: 6 if ($comms==true) { 7 8 //define a table name based on main Post number 9 10 11 //create a table 12 $sql = 'CREATE TABLE $newTable ( daUser VARCHAR( 255 ) NOT NULL ,'
13        . ' entryNumb INT NOT NULL ,'
14        . ' priv VARCHAR( 1 ) NOT NULL ,'
15        . ' comm BLOB NOT NULL ,'
16        . ' PRIMARY KEY ( entryNumb ) )';
17 18 19 $resulter = mysql_query($sql) or die("There has been an error creating table: $newTable"); 20 21 ---end on line 12 is where ive narrowed the error to. i know that the table name is what is supposed to be there but im trying to create this based on a post entry number and then adding "_comms" to the name.. so the comments table for post number 1 would be named: 1_comms im also having an issue with line 3, creating that name please help me :) thanks -AJ seelund

« previous php.db (#33380) next »