Jump to content

help please


spearchilduser

Recommended Posts

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";

Link to comment
https://forums.phpfreaks.com/topic/259294-help-please/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329211
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/259294-help-please/#findComment-1329221
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.