Re: mysql_query returning empty result after DELETE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes. I deleted all records.

Prior to the DELETE, if I did a SELECT with specific criteria (WHERE
p.pictureFile = "some valid content"), and those criteria were not met,
mysql_query() returned False ... and, conversely, if those criteria were
met, mysql_query() returned "a resource" against which I could use
mysql_fetch() to retrieve the rows returned by the SELECT.

After the DELETE, and as I explained in my original post, the same SELECT
with specific criteria returns, not False as it should, but "a resource"
which contains an empty row.

If I look at the database using MySQL Query Browser, it appears empty.

I do not understand what is happening.

Help understanding what is happening is what I seek. Can you help?

Thanks.


"Chris" <dmagick@xxxxxxxxx> wrote in message
news:4AAD74E5.3090505@xxxxxxxxxxxx
> Stan wrote:
> > I did a "DELETE FROM picture" where "picture" is a table in my database.
>
> Because this deletes all your records - so doing a select afterwards
> will find nothing.
>
> > Afterward, this piece of code does not generate an error
> > ----------------------------------------------
> > try
> >       {
> >       $query = "SELECT * FROM picture p " .
> >                           "WHERE p.pictureFile='" . $pictureFile . "'";
> >       $thisRow =
> >               mysql_query($query, $pictures_connection);
> >       }
> >       catch(Exception $e)
> >              {
> >              echo 'caught exception: ',  $e->getMessage()."\n";
> >              $result = False;
> >              }
>
> an empty result set is fine - it means no records found. It will not
> generate an exception.
>
> I'm not sure when mysql will generate an exception either, mysql_query
> returns FALSE if the query fails (see http://www.php.net/mysql_query).
> You then have to use mysql_error to get the reason why it failed.
>
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/
>



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux