stuckwithcode Posted January 6, 2011 Share Posted January 6, 2011 why does this not work $name = "john"; mysql_query("UPDATE table SET user = '$name'text WHERE id = '5'"); how can i get the query to insert the variable and the text eg johntext into the table Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/ Share on other sites More sharing options...
merylvingien Posted January 6, 2011 Share Posted January 6, 2011 Can you clarify what you are trying to do? You want to update the user table with the $name variable. I get that, but whats "text"? Is text another variable? Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/#findComment-1155645 Share on other sites More sharing options...
stuckwithcode Posted January 6, 2011 Author Share Posted January 6, 2011 no text is just some text that i want to be added to the end of the varaible Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/#findComment-1155646 Share on other sites More sharing options...
litebearer Posted January 6, 2011 Share Posted January 6, 2011 then use $new_var = $var1 . $var2 before you update Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/#findComment-1155647 Share on other sites More sharing options...
stuckwithcode Posted January 6, 2011 Author Share Posted January 6, 2011 I understand that method but was wondering if you can do it in the one line Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/#findComment-1155654 Share on other sites More sharing options...
trq Posted January 6, 2011 Share Posted January 6, 2011 mysql_query("UPDATE table SET user = '{$name}text' WHERE id = '5'"); Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/#findComment-1155657 Share on other sites More sharing options...
stuckwithcode Posted January 6, 2011 Author Share Posted January 6, 2011 that did it, cheers buddy Link to comment https://forums.phpfreaks.com/topic/223565-really-anoying-help-can-it-be-done/#findComment-1155659 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.