resultset view only

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pranaster
Forum Newbie
Posts: 2
Joined: Tue Apr 01, 2008 12:45 am

resultset view only

Post by pranaster »

Hi All,

I have a question (php i.c.w. mysql): if you use the function

Code: Select all

mysql_result($query);
You will get a resultset. And you can iterate through this resultset.

I guess that the resultset is just a table and you can iterate through it based on the row identifier. Can you delete rows from the resultset? (not from the database)

Thx

Kind Regards,
Pranay
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: resultset view only

Post by Christopher »

mysql_query() returns result set. mysql_result() return a row from a result set, not a result set. No you cannot delete a row from the result set. You should look at using mysql_fetch_*() functions instead of mysql_result() for the reasons mentioned in the manual.
(#10850)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: resultset view only

Post by onion2k »

Why would you want to do that?
pranaster
Forum Newbie
Posts: 2
Joined: Tue Apr 01, 2008 12:45 am

Re: resultset view only

Post by pranaster »

Oh okay thanks! I have got two data collections and what I actually want to do is say something like

SELECT * FROM <Table> WHERE <field> NOT IN (SUBQUERY).

The subquery really performs great but when I execute the whole query it performs bad so Iam looking into alternatives. I thought maybe I can solve it in PHP by creating two loops and each time I found something I can delete the row in the result set so the list gets smaller and so come closer to the required collection data.
Post Reply