antubob
05-06-2006, 12:34 PM
im using php(4.x) and mysql
i want to keep record for item that every customer have by from my shop. and it will display details of item such as quantity,color and type.
im planning to create individual table for each customer and userid will be use for naming the new table.
i create coding as below to retrieve data from table 123:
where's 123 is the table name and same as userid
<?php
$id = "123";
$result = mysql_query("SELECT * FROM $id") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
echo $row['type'];
}?>
but when i upload and run it.. i display an error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123' at line 1
i want to keep record for item that every customer have by from my shop. and it will display details of item such as quantity,color and type.
im planning to create individual table for each customer and userid will be use for naming the new table.
i create coding as below to retrieve data from table 123:
where's 123 is the table name and same as userid
<?php
$id = "123";
$result = mysql_query("SELECT * FROM $id") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
echo $row['type'];
}?>
but when i upload and run it.. i display an error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123' at line 1