spearchilduser Posted March 19, 2012 Share Posted March 19, 2012 im trying to get it so that if a user accepts a job then some details from one tbale get inserted into nother table so a tracker can activate the code im using is : mysql_query("SELECT User_ID,User_Longitude,User_Latitude INTO user_location FROM quotes) or die (mysql_error)); but im know its not of the correct format as im putting it in : if($sql) $msg = "Taxi Accepted sucessfully."; mysql_query("SELECT User_ID,User_Longitude,User_Latitude INTO user_location FROM quotes) or die (mysql_error()); else $msg = "Taxi not Accepted sucssfully try again."; echo "$msg"; Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/ Share on other sites More sharing options...
smerny Posted March 19, 2012 Share Posted March 19, 2012 you have no brackets around your if and else blocks... ie: if(conditional) { block } else { block } Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329205 Share on other sites More sharing options...
spearchilduser Posted March 19, 2012 Author Share Posted March 19, 2012 if($sql) { $msg = "Taxi Accepted sucessfully."; mysql_query("SELECT User_ID,User_Longitude,User_Latitude INTO user_location FROM quotes) or die (mysql_error()); } else { $msg = "Taxi not Accepted sucssfully try again."; echo "$msg"; } still not working Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329211 Share on other sites More sharing options...
samshel Posted March 19, 2012 Share Posted March 19, 2012 Check this. http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-select-into-table.html Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329214 Share on other sites More sharing options...
spearchilduser Posted March 19, 2012 Author Share Posted March 19, 2012 doesnt really explain the probelm with my statement thanks so Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329219 Share on other sites More sharing options...
premiso Posted March 19, 2012 Share Posted March 19, 2012 doesnt really explain the probelm with my statement thanks so Actually it does. Read the syntax and read the page. MySQL does not support "SELECT INTO" sybase syntax, instead it is INSERT INTO table_name (col1, col2) SELECT somecol1, somecol2 FROM table_name WHERE .... If you are going to ask for help, actually look at the answers given before dismissing them. So your statement, which was missing an ending quote should be from this: mysql_query("SELECT User_ID,User_Longitude,User_Latitude INTO user_location FROM quotes) or die (mysql_error)); To: mysql_query("INSERT INTO user_location (id, longit, lat) SELECT User_ID,User_Longitude,User_Latitude FROM quotes") or die (mysql_error())); You will need to change "id, longit, lat" to be what column names that data needs to go into. Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329221 Share on other sites More sharing options...
spearchilduser Posted March 19, 2012 Author Share Posted March 19, 2012 i appolosie im tired and didnt see the difference in my statement and the statement shown on the link so thank you Quote Link to comment https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329226 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.