Re: [PHP] About PHP & Oracle

2001-08-30 Thread Joel Ricker

> Dear all,
> Now i have an Oracle database. I have created a table contains 43 rows for
example. I use PHP to contact with my oracle. I want to write a script
access my Oracle for display data into table. Each time display 9 rows. So I
dont't know how to program such as "Page 1 2 3 4 Next".Can anybody show me
the way?And addition, when i use SQL command as "select * from table_name
where id>'$id' ", it didn't display at all.
> Thanks you in advance.
> BaDu

Below is some snippets of code from a project I just did where I did the
same thing.  You will have to do some editing for this but I hope it gives
you the general idea.  First of all, this was for MySQL but assuming that a
LIMIT statement in Oracle works the same as in MySQL, you should be ok.
Second of all, in some versions of MySQL numbering of table records for an
offset on LIMIT starts at 0, newer versions at 1.  I'm using the older
version as you can see but you will want to check your Oracle documentation
for future information.

query($q);
 $db->next_record();
 $numrows = $db->f("NumImage");

if (empty($offset)) {
  $offset=0; //Again, offset may be 1 or it may be 0.. check docs.
 }

 $q = "SELECT Photo_Image.*, Photo_Cat.Name FROM Photo_Image, Photo_Cat
WHERE Photo_Image.Cat_ID = '$id' AND Photo_Cat.Cat_ID = '$id' ORDER BY
SortOrder LIMIT $offset, $perpage";
$db->query($q);

// print stuff here

$pages = ceil($numrows/$perpage);

if ($offset - $perpage >= 0) {
 ?> [Prev]  1) {
 for ($x = 0; $x < $pages; $x++) {
   ?>   [Next] http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] About PHP & Oracle

2001-08-30 Thread Duy B

Dear all,
Now i have an Oracle database. I have created a table contains 43 rows for example. I 
use PHP to contact with my oracle. I want to write a script access my Oracle for 
display data into table. Each time display 9 rows. So I dont't know how to program 
such as "Page 1 2 3 4 Next".Can anybody show me the way?And addition, when i use SQL 
command as "select * from table_name where id>'$id' ", it didn't display at all.
Thanks you in advance.
BaDu