Re: Reset Informix Fetch Row
| From: | Paul Gardiner | Date: | Mon, 10 Jul 2000 15:46:26 +0000 |
| Subject: | Re: Reset Informix Fetch Row | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1008@lists.php.net to get a copy of this message | ||
Hi Dan
You've probably gathered by now ther are not too many of us Informix users
about. Never mind, I think what you need to play with is using the
IFX_SCROLL in your query line.
ifx_query("select blah from blah", $conn_id , IFX_SCROLL );
This sets up a SCROLL cursor which you can step back/forward/jump etc. Use
the Keywords FIRST,LAST,NEXT,PREVIOUS,CURRENT,RELATIVE integer,ABSOLUTE
integer in your ifx_fetch_row line.
e.g.
$row = ifx_fetch_row ($rid, "FIRST");
$row = ifx_fetch_row ($rid, "NEXT");
Hope you get the idea :-)
Regards,
- Paul -
----- Original Message -----
From: Dan Fitzpatrick <dan@rapidascent.com>
To: <php-db@lists.php.net>
Sent: 09 July 2000 03:38
Subject: [PHP-DB] Reset Informix Fetch Row
> How do you reset an IFX_FETCH_ROW to start at row 0 after already
> looping through the query results? I want to display a table of contents
> menu for a page. Then loop through the same query to output the actual
> body of each record. I could set a variable in the initial loop that
> would be the content of the output for what would have been that second
> loop, but I don't know if that is the most efficient solution.
>
> Example:
>
> // Query results = 10 records with the fields: recordid, title, body
> // Output a table of contents for the page
> echo "<ul>";
> while ($row = ifx_fetch_row($results)) {
> $id = $row[recordid];
> $title = $row[title];
> echo "<li><a href=#a$id>$title</a>\n";
> }
> echo "</ul><hr>";
>
> // This is what I use in MySQL
> mysql_data_seek ($results, 0); // How do you do this with Informix?
>
> // Output the same query with the anchor, title, and body of the content
>
> while ($row = ifx_fetch_row($results)) {
> $id = $row[recordid];
> $title = $row[title];
> $body = $row[body];
> echo "<a
> name=a$id></a><br><b>$title</b><br>$body<br><br>\n";
> }
>
> Thanks,
>
> Dan
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>