Page 1 of 1

resultset view only

Posted: Tue Apr 01, 2008 12:52 am
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

Re: resultset view only

Posted: Tue Apr 01, 2008 1:01 am
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.

Re: resultset view only

Posted: Tue Apr 01, 2008 2:39 am
by onion2k
Why would you want to do that?

Re: resultset view only

Posted: Tue Apr 01, 2008 8:48 am
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.