spaceman12 Posted December 28, 2010 Share Posted December 28, 2010 how do i insert two same values bearing variable into the same row though different column into a database? Insertion was successful but at the end I always end up getin an error for which I was not allowed a redirection...thanx error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES('spaceman12', 'ja')' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 28, 2010 Share Posted December 28, 2010 Without the whole query that is part of, it's kind of impossible to help you. Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/#findComment-1152334 Share on other sites More sharing options...
spaceman12 Posted December 28, 2010 Author Share Posted December 28, 2010 $insertMES="INSERT INTO messaging( Date, Time, Subject, Message, From_User, To_User, Message_Alert, IP, Sender) VALUES( '".$date."', '".$time."', '".mysql_real_escape_string($subject)."', '".mysql_real_escape_string($message)."', '".$_SESSION['Username']."', '".$send_to."', '".mysql_real_escape_string($message_alert)."', '".$IP."', '."$_SESSION[username]."')"; mysql_query($insertMES); Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/#findComment-1152337 Share on other sites More sharing options...
Rifts Posted December 28, 2010 Share Posted December 28, 2010 look at what you wrote $_SESSION['Username'] and $_SESSION[username] see a problem? Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/#findComment-1152338 Share on other sites More sharing options...
spaceman12 Posted December 28, 2010 Author Share Posted December 28, 2010 well,,,sorry for the wrong quotation but it just remain the same even after the alteration,,,,,,thnx Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/#findComment-1152340 Share on other sites More sharing options...
Rifts Posted December 28, 2010 Share Posted December 28, 2010 also you should do mysql_real_escape_string before inserting into db Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/#findComment-1152341 Share on other sites More sharing options...
PFMaBiSmAd Posted December 28, 2010 Share Posted December 28, 2010 There's really no way that the error you posted came from the query you are posting. Quote Link to comment https://forums.phpfreaks.com/topic/222847-help-inserting-two-same-variables-into-the-same-row-of-db/#findComment-1152362 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.