bruckerrlb Posted November 6, 2009 Share Posted November 6, 2009 I have a pretty simple question, been searching for a while though and can't seem to figure out the syntax I have the following query $insertpost = mysql_query("INSERT INTO swticketposts (ticketid, dateline, fullname, email, contents) VALUES('$spot_id', '$today', '$username', '$user_email', '$message')") or die(mysql_error()); In the $message value, I'd like to insert more than just the variable $message, I'd like to insert something like $message = $_POST['description']."<br />User who entered this". $username ."<br />Their phone number". $phone ."other information". $othervariable; How can I either insert this directly into the Values part of the query or turn it into a variable that can be passed to mysql? Quote Link to comment https://forums.phpfreaks.com/topic/180578-solved-joining-strings-and-variables-into-the-values-of-an-insert/ Share on other sites More sharing options...
Mchl Posted November 6, 2009 Share Posted November 6, 2009 Just like you're doing it now. Except you should run it through mysql_real_escape_string first. Quote Link to comment https://forums.phpfreaks.com/topic/180578-solved-joining-strings-and-variables-into-the-values-of-an-insert/#findComment-952689 Share on other sites More sharing options...
bruckerrlb Posted November 6, 2009 Author Share Posted November 6, 2009 Yep that worked great, I appreciate it! Quote Link to comment https://forums.phpfreaks.com/topic/180578-solved-joining-strings-and-variables-into-the-values-of-an-insert/#findComment-952698 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.