| | |
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 basic beginner binary body broken cache cakephp class cms code computing confirm cron curl customizableitems database date date/time delete display dynamic email error file filter folder form forms forum function functions gc_maxlifetime google header headmethod howtowriteathesis href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation neutrality oop parameter parsing paypal pdf php phpmysql query question random recourse regex script search select seo server sessions snippet source space sql static system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube





