You are here: Re: deleting a mysql record in active result « PHP Programming Language « IT news, forums, messages
Re: deleting a mysql record in active result

Posted by Jerry Stuckle on 04/13/06 01:15

Bob Bedford wrote:
> Hello,
>
> I'm doing a select in wich I retrieve some values.
>
> If the value is in an array, I must delete the record.
>
> As I'm doing a "mysql_fetch_object", may I delete this record inside the
> loop ?
>
> when doing a mysql_query, do I have a "local" copy or just a link to the
> mysql query result. In the first case I may delete the record as I get an
> "image" of the query result, in the second case I shouldn't as the query
> result will be changed by the deletion of any record.
>
> Bob
>
>
>

Bob,

I'm not sure whether you can do it safely or not - I've never tried.

What I do is something I learned many, many moons ago when I was working on a
mainframe database (DB2). When I want to delete a row, I will save it's id in
an array. Then after I'm done with the result set, I go back and build a delete
command to get rid of all of them at one time. Or, you could issue several
delete commands to get rid of them individually.

It solves any potential problems which might result, especially if you change
databases (not likely - but who knows?).


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация