Jump to content


Photo

adding rows to another table where values are a variable


  • Please log in to reply
2 replies to this topic

#1 blanktarget

blanktarget
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 15 November 2003 - 12:18 AM

I have a listing that needs to added from a content management system. The add script is getting the row\'s id from the page before it
$id=$_GET[\'id\'];

what I want to do is have that number which exists in a table for temporary listings and move it (with the \'add\' script) into the permament \'listing\' table from the content management system.
$query="INSERT INTO listing (business, name, address, phone, website, email,) VALUES (\'business\',\'name\', \'address\', \'phone\', \'website\', \'email\',) FROM temp_listing WHERE temp_listing_id=\'$id\'"$result=mysql_query($query);

It\'s not that I don\'t know how to do it, i just haven\'t learned it yet.

#2 Guest_Weirdan_*

Guest_Weirdan_*
  • Guests

Posted 15 November 2003 - 12:45 AM

insert into listing (business, name, address, phone, website, email) select business, name, address, phone, website, email from  temp_listing where temp_listing_id=\'$id\'
?

#3 blanktarget

blanktarget
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 15 November 2003 - 05:28 AM

Thanks. That worked well, I had to change \"\'$id\'\" to \' . $id \'
:P
It\'s not that I don\'t know how to do it, i just haven\'t learned it yet.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users