Re: MySQL query problems

From: Date: Wed, 17 Apr 2002 15:14:11 +0000
Subject: Re: MySQL query problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93337@lists.php.net to get a copy of this message
On Wednesday 17 April 2002 19:48, Petre Agenbag wrote: [snip] > So, to get to my question, how can I do a "test" sql execution on a > table, and then , only when the expected result is returned, should the > actual sql be executed. Obviously this is not needed for simple > "selects" as they don't change data in the table, but the same would be > needed for "delete from". Basically, if I could check the mysql_num_rows > output of the query ( for updates and deletes as I use them, I could > always check to make sure that it is only 1), and only if it is 1, > should the query actually take place. I hope I have stated the question > clear enough, if not, please mail me and I'll try to elaborate. What is a MySQL question doing in a PHP list? As for the answer to your question, do a: SELECT * table WHERE condition check that the rows you want to delete are correct, then DELETE FROM table WHERE condition -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Where it is a duty to worship the sun it is pretty sure to be a crime to examine the laws of heat. -- Christopher Morley */

« previous php.general (#93337) next »