codrgii Posted July 5, 2009 Share Posted July 5, 2009 Is it possible to use a variable as a tablename? Below is a reference on what I am trying todo. Any pointers or clues would be greatly appreciated!! $query = "UPDATE users SET '$table' = '$table'+18 WHERE id='$id'"; Link to comment https://forums.phpfreaks.com/topic/164824-php-table/ Share on other sites More sharing options...
trq Posted July 5, 2009 Share Posted July 5, 2009 Assuming you mean a filed rather than a table (which is what your code looks to be refering to). $query = "UPDATE users SET $table = $table+18 WHERE id=$id"; Field identifiers are not strings, hence, do not (and cannot) be surrounded by quotes. Link to comment https://forums.phpfreaks.com/topic/164824-php-table/#findComment-869141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.