Informix DB
Posted in 2000
Topics: General Discussion
Hi, I've a database. When i want to publish it (with PHP) then i use ifx_htmltbl_result to create a table with the result of a query. But is it also possible that i make a screen with 1 record, so i have to push on a button to see the second record? (like movenext or something) If yes, how? Is there an example script somewhere on the internet where i can look? Best regards, Tom
Try http://examples.informix.com/frameset.html Good luck! Peter Tom Franssen <franssen.tom@menlolog.com> schrieb in im Newsbeitrag: 8tjmsl$a6g$1@ljcqs015.cnf.com... > Hi, > > I've a database. When i want to publish it (with PHP) then i use > ifx_htmltbl_result to create a table with the result of a query. > But is it also possible that i make a screen with 1 record, so i have to > push on a button to see the second record? (like movenext or something) If > yes, how? Is there an example script somewhere on the internet where i can > look? > > Best regards, > Tom > >
Tom Franssen wrote: > > Hi, > > I've a database. When i want to publish it (with PHP) then i use > ifx_htmltbl_result to create a table with the result of a query. > But is it also possible that i make a screen with 1 record, so i have to > push on a button to see the second record? (like movenext or something) If > yes, how? Is there an example script somewhere on the internet where i can > look? > > Best regards, > Tom Hi I had a similar situation, but I wanted to display a list of 5 records on a page, and then let the user scroll forwards and backwards a page at a time. I ended up doing something like what I have shown below. It is not particularly efficient since it basically re-runs the query on each new page, but on the whole I find performance is not too bad on my system. It might be possible to somehow hold the query open between pages using session variables, but I have not yet had a chance to experiment with doing this. Note also that you need to pass in an initial value of start_pos (= 1) the first time you link to this page. --------------------------------------------------------- <html> <head> <title>List Records</title> </head> <body> <?php $conn_id = ifx_pconnect("db@machine") or die("couldnt connect\\n"); $sql_text = "select * from mytable ". "where mysearchcol = 'A' "; $res_id = ifx_query($sql_text, $conn_id, IFX_SCROLL); if (! $res_id) { printf("Can't select rows : %s\\n<br>%s<br>\\n", ifx_error()); ifx_errormsg(); die; } $more_rows = TRUE; for ($row_to_get = $start_pos; $row_to_get < $start_pos + 5; $row_to_get++) { $row = ifx_fetch_row ($res_id, (int)$row_to_get); if (!$row) { $more_rows = FALSE; break; } echo $row["mydisplaycol1"]. " ". $row["mydisplaycol2"]. "<br>"; } ifx_free_result ($res_id); if ($more_rows) { ?> <form name="nextlist" action="list.php" method="GET"> <input type=submit value="Next 5"> <input type=HIDDEN name="start_pos" value="<?php echo $start_pos + 5;?>"> </form> <?php } if ($start_pos > 1) { ?> <form name="prevlist" action="list.php" method="GET"> <input type=submit value="Previous 5"> <input type=HIDDEN name="start_pos" value="<?php echo $start_pos - 5;?>"> </form> <?php } ?> </body> </html>