Jump to content

help with mysql_insert_id();


jcjst21

Recommended Posts

Hello,

 

I used the mysql_insert_id() command on another script i wrote, and it worked fine.

I pretty much reused the same code on another script for another table and it doesn't seem to be working.

 

Here is my code:

$sql="INSERT INTO AllergyList(camperID, camperAllergy) VALUES ('$camperID', '$allergy')";
$result = mysql_query($sql,$con);
$allergyID=mysql_insert_id();

$sql2="INSERT INTO camperAllergyReactions(camperAllergyID, camperAllergyReaction) VALUES ('$allergyID', '$reaction')";

 

the first INSERT statement populates the data fine into the Allergy table, but the mysql_insert_id() does not seem to be working in this script.

 

Any help would be appreciated.

 

Thanks,

jcjst

Link to comment
https://forums.phpfreaks.com/topic/243756-help-with-mysql_insert_id/
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.