Jump to content

Whats wrong with this insert code.


xilllly

Recommended Posts

Hi, I'm trying to copy some values from a table called "member" to a table called "report" when new members submit a php application form. I can't see what's wrong with it. I have attached screenshots of the 2 tables and their structure. Any help would be much appreciated.

 

global $conn,$dal;

$customerID = mysql_insert_id();

$strSQLInsert = "insert into report (appID, memberID, select_agent, agent_details, first_name, last_name, street_address, suburb, postcode) values (".$ID.", ".$ID.", '".$values["select_agent"]."', '".$values["agent_details"]."', '".$values["first_name"]."', '".$values["last_name"]."',  '".$values["street_address"]."', '".$values["suburb"]."', '".$values["postcode"]."')";

 

db_exec($strSQLInsert,$conn);

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/251592-whats-wrong-with-this-insert-code/
Share on other sites

MySQL is a relational database.  So you shouldn't be copy`in anything to another table.  Just send over the unique id for the row you want to "copy".  If the same data resides in multiple tables in your application, you will run into bottle necks in the future. 

 

 

Just a helpful note.

Go here, and read about "ignoring normalization" the whole article is great, but that is the part to pay particular attention to.

 

Then

make sure to watch all 9 lessions.

 

Then familiarize yourself with MySQL's JOIN syntax.

 

Perhaps then you may wish for a lesson in using it, or you could ask for some help here.

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.