kev wood Posted November 20, 2008 Share Posted November 20, 2008 i thought i had this working but alas i was wrong. the variable $table is getting posted to the page via a hidden form input, and i know this because it lets me echo it out. the problem lies in this code somewhere. $run=mysql_query ('SELECT max(id) from $table') or die(mysql_error()); $lastid = mysql_fetch_row($run)or die(mysql_error()); $lastid=$lastid[0]or die(mysql_error()); $sql="UPDATE $table SET image= '$consname2' WHERE id= '$lastid'"or die(mysql_error()); $query = mysql_query($sql)or die(mysql_error()); when i select the image to up load i get the error Table 'xxxxxxxxxdb.$table' doesn't exist why will it let me echo the variable but not let me use it inside the query. Link to comment https://forums.phpfreaks.com/topic/133513-so-close-yet-so-far/ Share on other sites More sharing options...
gevans Posted November 20, 2008 Share Posted November 20, 2008 $run=mysql_query ("SELECT max(id) from $table") or die(mysql_error()); Use double quotes if you want PHP to find a variable within them Link to comment https://forums.phpfreaks.com/topic/133513-so-close-yet-so-far/#findComment-694434 Share on other sites More sharing options...
kev wood Posted November 20, 2008 Author Share Posted November 20, 2008 thanks for the reply i will try that. Link to comment https://forums.phpfreaks.com/topic/133513-so-close-yet-so-far/#findComment-694458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.