I have the table name in the form as a hidden field, i have to do it this way for some reason but it’s not working when i do the following:
// This is being processed from the previous page in a form
$table = mysql_real_escape_string($_POST['just_field']);
//Here i am using the $table value to use in place of a table name
$sql = "select `Field` from `$table` where `another_field` = '$id'
and `another_another_field` = '$something'";
$query = mysql_query($sql) or die ("Error: ".mysql_error());
while ($row = mysql_fetch_array($query)){
$somefield = $row['field'];
}
mysql_free_result($query);
How can i make it work so the $table is being read by the command…
try to include the connection string
if you are not using any framework