[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-db
Subject:    Re: [PHP-DB] problem in recorset that seems temporary
From:       Krister_Karlström <krister.karlstrom () arcada ! fi>
Date:       2008-01-25 18:26:35
Message-ID: 479A29DB.2080309 () arcada ! fi
[Download RAW message or body]

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();

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic