Jump to content

INSERT...WHERE...using $ variables


darkenroyce

Recommended Posts

Hi Guys

 

I'm getting the syntax problem with the following code:

 

$sql="INSERT INTO squad (players) VALUES ('$_POST[playerid]') WHERE p_id="$id"";
  mysql_query($sql, $con) or die(mysql_error());

 

p_id is the player ID within the SQL table, and $id - $id = $_GET ['n_id']; - is a integer php variable passed through a URL.

 

Tried to googling this but found no simple syntax correction.

 

Please advise....

 

Cheers

 

Darkenroyce

Link to comment
https://forums.phpfreaks.com/topic/101104-insertwhereusing-variables/
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.