AW: [PHP-DB] multiple queries in PHP to mysql database.
| From: | Blain | Date: | Fri, 28 Mar 2003 06:27:34 +0000 |
| Subject: | AW: [PHP-DB] multiple queries in PHP to mysql database. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26666@lists.php.net to get a copy of this message | ||
Hi
After Updateing the table1:
"SELECT username, score FROM table1 WHERE $select='$winner'";
Then you have your Informations..
Cya Blain
-----Ursprüngliche Nachricht-----
Von: JeRRy [mailto:jusa_98@yahoo.com]
Gesendet: Freitag, 28. März 2003 02:31
An: php-db@lists.php.net
Betreff: [PHP-DB] multiple queries in PHP to mysql database.
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.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php