Re: problem in recorset that seems temporary
| From: | Krister Karlström | Date: | Fri, 25 Jan 2008 18:26:35 +0000 |
| Subject: | Re: problem in recorset that seems temporary | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44541@lists.php.net to get a copy of this message | ||
Hi!
I did not quite get the point here, but maybe that's not needed to solve the problem... :-)
First of all, you seem to have enabled the register_global setting, since I can't see from where the parameter $id is posted. Use the $_GET or $_POST superglobal array instead. Take big care of input filtering also and do not put "dirty" data directly into your query.
Second, the function mysql_db_query() has been deprecated for a long time now, use mysql_select_db() and mysql_query() instead.
I think your problem is in your while-loop:
You loop over the result set $result and fetch the row as an object.
Then you execute a delete statement and at the same time overwriting your previous result set $result, thus you will break the loop with an error that the provided parameter is not a result set.
I also guess you have a typo in your last statement where you (probably) try to delete the gallery. I guess that you maybe want to use the variable $galerie_id..? Well, I can't tell without any more information about your application.
Greetings,
Krister Karlström, Helsinki, Finland
Ruprecht Helms wrote:
while($row = mysql_fetch_object($result)) { $galerie_id=$row->ID; $result=mysql_db_query("pferdeservice-karle","DELETE FROM Galerie_kultur WHERE GalerieID=$id"); } $result=mysql_db_query("pferdeservice-karle","DELETE FROM Galerie WHERE ID=$id"); echo mysql_error();