So you use the INSERT INTO ... SELECT ... to do the select from table 1 and the insert into table 2. Then use a DELETE to erase the info from table 1.
Show your script so far, we can't help you much more without seeing what you're doing. ---John Holmes... > -----Original Message----- > From: Verdon Vaillancourt [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 14, 2002 10:18 PM > To: [EMAIL PROTECTED]; 'PHP-General' > Subject: Re: [PHP] Storing/passing variables through multiple- > partfunction/casestatement > > I have to get the data from table1, delete the data from table1, put the > data into table2. I'm either not getting the data from table1 or am not > passing it to table2, I'm not sure which. > > On 10/14/02 6:37 PM, "John W. Holmes" <[EMAIL PROTECTED]> wrote: > > > INSERT INTO table2 SELECT * FROM table1 WHERE ... > > DELETE FROM table1 WHERE ... > > > > Where are you stuck? > > > > ---John Holmes... > > > >> -----Original Message----- > >> From: Verdon Vaillancourt [mailto:[EMAIL PROTECTED]] > >> Sent: Monday, October 14, 2002 4:31 PM > >> To: PHP-General > >> Subject: [PHP] Storing/passing variables through multiple-part > >> function/casestatement > >> > >> Hi, > >> > >> Iım trying to cobble together a case where where data is retrieved > > from > >> one > >> row of a mySQL table, the row is deleted, the retrieved data is > > inserted > >> into a new row in different table. Most of my code seems to be working > > (I > >> think the data is being retrieved, the old row is being deleted, the > > new > >> row > >> is being created) but I am not getting a grip on how to pass the > > retrieved > >> data into the sql insert statement for the new row in the second > > table. > >> Iım > >> sure Iım missing something very basic and would appreciate any help > >> extended. The case statement as is now, is below. > >> > >> TIA, verdon > >> > >> Ps. Please cc me in any answer to the list as I am on digest mode > >> > >> case "finishPending": > >> if ($user_dblocation) > >> { > >> @mysql_select_db("$user_dbname") or die ("Unable to select > >> database"); > >> > >> $result = mysql_query("select uid, uname, name, url, > > email, > >> femail, pass, company, bio, description, address, city, province, > >> postcode, > >> phone, fax, tollfree, otherphone, cat AS uid, uname, name, url, email, > >> femail, pass, company, bio, description, address, city, province, > >> postcode, > >> phone, fax, tollfree, otherphone, cat from " . > > $table_prefix."users_que > >> where uid='$approve_uid'"); > >> list($uname) = mysql_fetch_row($result); > >> > >> mysql_query("lock tables " . $table_prefix."users_que > > WRITE"); > >> mysql_query("delete from " . $table_prefix."users_que > > where > >> uid='$approve_uid'"); > >> mysql_query("unlock tables"); > >> @mysql_select_db("$dbname") or die ("Unable to select > >> database"); > >> } > >> else > >> { > >> $result = mysql_query("select uid, uname, name, url, > > email, > >> femail, pass, company, bio, description, address, city, province, > >> postcode, > >> phone, fax, tollfree, otherphone, cat AS uid, uname, name, url, email, > >> femail, pass, company, bio, description, address, city, province, > >> postcode, > >> phone, fax, tollfree, otherphone, cat from " . > > $table_prefix."users_que > >> where uid='$approve_uid'"); > >> list($uname) = mysql_fetch_row($result); > >> > >> mysql_query("lock tables " . $table_prefix."users_que > > WRITE"); > >> mysql_query("delete from " . $table_prefix."users_que > > where > >> uid='$approve_uid'"); > >> mysql_query("unlock tables"); > >> } > >> > >> mysql_query("LOCK TABLES " . $table_prefix."stories WRITE"); > >> mysql_query("UPDATE " . $table_prefix."stories SET > >> informant='$anonymous' WHERE informant='$uname'"); > >> mysql_query("UPDATE " . $table_prefix."stories SET > >> aid='$anonymous' > >> WHERE aid='$uname'"); > >> mysql_query("UNLOCK TABLES"); > >> > >> global $uid, $uname, $name, $url, $email, $femail, $pass, > >> $company, > >> $bio, $description, $address, $city, $province, $postcode, $phone, > > $fax, > >> $tollfree, $otherphone, $cat; > >> > >> $sql = "insert into ".$table_prefix."users > >> > > (name,uname,email,femail,url,pass,company,bio,description,address,city,p > > ro > >> vi > >> nce,postcode,phone,fax,tollfree,otherphone,cat,conversionflag) values > >> > > ('$name','$uname','$email','$femail','$url','$pass','$company','$bio','$ > > de > >> sc > >> > > ription','$address','$city','$province','$postcode','$phone','$fax','$to > > ll > >> fr > >> ee','$otherphone','$cat','1')"; > >> > >> if ($user_dblocation) > >> { > >> @mysql_select_db("$user_dbname") or die ("Unable to select > >> database"); > >> mysql_query("lock tables " . $table_prefix."users WRITE"); > >> $result = mysql_query($sql); > >> mysql_query("unlock tables"); > >> @mysql_select_db("$dbname") or die ("Unable to select > >> database"); > >> } > >> else > >> { > >> mysql_query("lock tables " . $table_prefix."users WRITE"); > >> $result = mysql_query($sql); > >> mysql_query("unlock tables"); > >> } > >> > >> if (!$result) > >> { > >> echo mysql_errno(). ": ".mysql_error(). "<br />"; > >> return; > >> } > >> > >> html_header_location("admin.php?op=adminMain"); > >> echo mysql_error(); > >> break; > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php