I've since deleted the code and did it another way. The code however went
something like this. This is just a mock up (there is more being selected
etc and there are some joins, but the syntax is exact).

So what happens is the select statement with $user1 in it gets the proper
values (the first one in the example), the other one doesn't, but if I
change $user1 and $user2 around the second select will get the values.

So on the surface it sounds like a problem with $user2, but I have run
extensive tests and $user2 gets the proper values (they both come from a
form).

In another project I am doing, I tried a similar feat with totally different
values and got the same results. This time I was trying to do one SELECT and
one UPDATE.

If anyone has any ideas it would be appreciated. Also, if there is a better
way to do the following this would also be appreciated.

$query "select number from table1 where userid=$user1";
$result = mysql_query($query) or die("Query failed");

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $num1 = $line['number'];
}

$query "select number from table2 where userid=$user2";
$result = mysql_query($query) or die("Query failed");

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $num2 = $line['number'];
}

$total = $num1 + $num2;

mysql_query("UPDATE table3 SET total = '$total' WHERE userid=$user");

TIA

----- Original Message -----
From: "Steve Yates" <[EMAIL PROTECTED]>
To: "MySQL List" <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 5:12 PM
Subject: Re: MySQL and PHP question


> On Wed, 18 Dec 2002 16:05:35 -0500, C. Reeve wrote:
>
> >I can not use two mysql queries in the same PHP file
>
> Please post code snippets, this is possible.
>
>  - Steve Yates
>  - Burger Borg:  We do it our way; yours is irrelevant.
>
> ~ Taglines by Taglinator - www.srtware.com ~
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to