Re: multiple queries in PHP to mysql database.
| From: | Foong | Date: | Fri, 28 Mar 2003 02:46:22 +0000 |
| Subject: | Re: multiple queries in PHP to mysql database. | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26665@lists.php.net to get a copy of this message | ||
sorry i am abit slow
it would be helpful if you can describe what's store and purpose of the 2
tables
Foong
"Jerry" <jusa_98@yahoo.com> wrote in message
news:20030328013118.62773.qmail@web41215.mail.yahoo.com...
>
> Hi,
>
> I just noticed a problem with my question which would
> cause major problems in my db. So let me re-ask it
> again.
>
> How can I update 2 tables at once if a match occours
> from information inputed into a PHP form.
>
> Now this is what each table has.
>
> table1:
> id
> username
> game1
> game2
> game3
> game4
> game5
> game6
> game7
> game8
> score
>
> table2:
> id
> username
> password
> sid
> score
>
> I have this:
>
> $sql = "UPDATE table1 SET score=score+1 WHERE
> $select='$winner'";
>
> mysql_query("$sql");
> echo("Points credited? I hope!<br><br>");
> }
> else {echo("An error occoured, please click back
> button and try again.");}
>
> Now that works fine and updates correctly.
>
> But now I want a second table to be updated. So if
> username blah got +1 I need table2 to update it's
> score for blah to +1. The query above updates if it
> finda a match in table1 and does not require the use
> of a username to update. But for table2 I am guessing
> it WILL need to know the username or id to update the
> appropiate field and not update everyones score to +1.
> So how is this achieved? Or am I doing this a hard
> way?
>
> Jerry
>
>
>
> http://mobile.yahoo.com.au - Yahoo! Mobile
> - Check & compose your email via SMS on your Telstra or Vodafone mobile.