Kelly Meeks wrote: > > Ok > > Let's say I'm querying a table, and looping thru the results: > > $connect=mysql_connect(host,user,pass); > $thedb=mysql_select(database1); > $thequery="select * from foo"; > $theresult=mysql_query($thequery) or die (mysql_error()) > while ($output=mysql_fetch_assoc($theresult)){ > > do stuff here.. > > } > > What if while I'm looping, I want to take the information I'm looping thru, > and want to write it to completely different database, assuming that the > same username and password info works for both databases? > > Would you use multiple mysql_select_db statements, and then make refer. to > the result of that select in your queries? > > I'm getting errors when I do that. > > Sorry to be so moronical,
This is not moronical, it gets a lot of coders... what you need to do is create another connection because the value returned from the mysql_connect function is a resource identofier, which means if you run two queries on the same connection the second result set will overwrite the first. Cheers, Rob. -- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php