| | |
Double MySQL Query
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2004
Posts: 94
Reputation:
Solved Threads: 0
I have been looking into ways I to cut down on MySQL Querys in a page and I was wandering if you could up to update querys into one mysql_query function like this:
[php]mysql_query("UPDATE table SET val1=val1+1, val2=val2+1 WHERE id = (int); UPDATE table SET val3=val3+1, val4=val4+1 WHERE id = (int)") or die(mysql_query());[/php]
*Note: both the (int) values are different.
[php]mysql_query("UPDATE table SET val1=val1+1, val2=val2+1 WHERE id = (int); UPDATE table SET val3=val3+1, val4=val4+1 WHERE id = (int)") or die(mysql_query());[/php]
*Note: both the (int) values are different.
not sure about the update thing, but in your or die statment you should change it to
[php]or die(mysql_error());[/php]
that way you can tell what the error might be that your recieving.
also i dont see a problem with sending various mysql query's its a good way to keep things from getting messy on a single line.
[php]or die(mysql_error());[/php]
that way you can tell what the error might be that your recieving.
also i dont see a problem with sending various mysql query's its a good way to keep things from getting messy on a single line.
Dont forget to spread the reputation to those that deserve!
•
•
Join Date: Jul 2007
Posts: 1
Reputation:
Solved Threads: 0
mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server (see http://www.php.net/mysql_query for more info)
![]() |
Similar Threads
- test mysql query for no results (PHP)
- how to generate a mysql query from a english question (MySQL)
- how to generate a mysql query from a english question #1 (Java)
- Python Tuples and Mysql Query (MySQL)
- MySQL query's (MySQL)
- Change MySQL Query Timeout Period (MySQL)
Other Threads in the PHP Forum
- Previous Thread: Teaching yourself PHP for idiots
- Next Thread: Passing Variables
| Thread Tools | Search this Thread |
apache api array auto beginner binary broken cache cakephp checkbox class cms code codingproblem cron curl customizableitems database date display dynamic echo email error errorlog file files filter folder form format forms forum function functions gc_maxlifetime global google headmethod href htaccess html image include insert ip javascript joomla limit link login mail malfunctioning memmory memory menu method mlm multiple mysql nodes oop parameter parsing paypal pdf php phpmysql popup query radio random recursion recursiveloop remote script search select server sessions snippet source space sql static survey syntax system table trouble tutorial up-to-date update upload url validator variable video web youtube





