Results 1 to 5 of 5
Feb 21, 2013, 22:18 #1
- Join Date
- Jun 2011
- 0 Post(s)
- 0 Thread(s)
SELECT * FROM $variable as table name problem
Im trying to load a page with a table from my mysql database.
Im using a dynamic variable as the table name instead of a static table name( this is obviously giving the mysql_error)
$classcode = mysql_real_escape_string($_POST['classcode']);
$q = "SELECT * FROM `$classcode`";
$query = mysql_query($q) or die(mysql_error);
Unfortunately, because each of these tables is created dynamically, I cant select information from one with a static name, as each name will be generated seperately, etc, hoepfully you see the dilemma.
Any help at all is greatly appreciated. Thanks in advance