On 10/14/02 11:07 PM, "John W. Holmes" <[EMAIL PROTECTED]> wrote:

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

Hi John, Thanks for your input on this and a other question/answers I have
read on this list. I did get this working, though likely in not the most
elegant manner. 

For instance, if I understand your hint correctly, I didn't know you could
put INSERT INTO ... SELECT ... In the same statement!

I did have too much code in the 1st post I made on this topic and the
relevant parts likely got lost in the forest ;)  If you're curious, I have
quoted what is now working for me below.

Salut, verdon

        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 from " . $table_prefix."users_que
where uid='$approve_uid'");
            list($uid, $uname, $name, $url, $email, $femail, $pass,
$company, $bio, $description, $address, $city, $province, $postcode, $phone,
$fax, $tollfree, $otherphone, $cat) = mysql_fetch_row($result);

        $sql = "insert into ".$table_prefix."users
(name,uname,email,femail,url,pass,company,bio,description,address,city,provi
nce,postcode,phone,fax,tollfree,otherphone,cat,conversionflag) values
('$name','$uname','$email','$femail','$url','$pass','$company','$bio','$desc
ription','$address','$city','$province','$postcode','$phone','$fax','$tollfr
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;
        }

            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");
        }


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to