Skip to main content
Known Participant
January 10, 2011
Question

PHP MySQL SELECT INSERT

  • January 10, 2011
  • 1 reply
  • 1907 views

I have a registration page with a html form. I have created an insert record server behavior that insert all the data into a MySQL database table fine. What I like to do additionally is to insert the data from a single row, actually the last row, into another table in the same mysql database. I have heard of MySQL insert-select but I can't seem to make it work on my own.  Is insert-select possible with Dreamweaver? If not, what should I use?

I appreciate any help

This topic has been closed for replies.

1 reply

January 10, 2011

Inserting all data into another table is redundant. You only need to pass the primary key to a new table when necessary and use the JOIN argument in your query to JOIN data from seperate tables for one user.

irajiAuthor
Known Participant
January 10, 2011

Sorry if I was misleading. I like to pass the data from 3 columns of the last row of the table to another table.

January 10, 2011

Thank you both. The reason for two tables is being notified is a feature not all users select to have and some that will select it need to be notified when a post about them has been written and they need to be notified privately. Does that explain it?

If you think this is redundant, then how should it be done?


being notified is a setting that is already in table 1. So, again, why put it into table 2? It should be done by SELECT-ing data from table1 WHERE being_notified = yes AND (optional) person_written_about = parameter passed to query identifying the user id that something was written about.