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
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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.