PHP/ORACLE Pagination
Hi All,
Can any one help me to create PHP/ORACLE Pagination..
Thanks
Sam
Hi pals
Here is a good easy sample of pagination using Oracle in PHP, Please notice that I have a layer, running different queries which I need, and in some lines below I've used them but the names of the function and variable which I've called are obviously seen that how they perform.
Further, Please note that you would be expected to call your own oracle database through PHP oracle functions, and as you can see, I have a table storing page sessions and the function "oracle->select" runs the query "SELECT * FROM SESSION_ID" and returns its result and the variable "numberrows" has the number of rows which the implemented query has returned.
<html>
<head>
<title>PAGING</title>
</head>
<body>
<?
session_start();
$session_check = $orcl->oracle_select("SESSION_ID", "*");
$Per_Page = 10; // Per Page
$Num_Rows = $orcl->numberrows;
if( !isset( $_GET["Page"] ) )
$Page=1;
else
$Page = $_GET["Page"];
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = ( ( $Per_Page*$Page ) - $Per_Page );
if( $Num_Rows <= $Per_Page )
$Num_Pages =1;
else if( ( $Num_Rows % $Per_Page ) == 0 )
$Num_Pages = ( $Num_Rows / $Per_Page );
else
$Num_Pages = ( $Num_Rows / $Per_Page ) + 1;
$Num_Pages = (int)$Num_Pages;
$Page_End = $Per_Page * $Page;
if ( $Page_End > $Num_Rows )
$Page_End = $Num_Rows;
?>
<table width="800" border="1" cellpadding="0" cellspacing="0" style="font-size: 12px; font: Tahoma">
<tr>
<th width="400" align="center">CUSTOMER</th>
<th width="400" align="center">Name</th>
</tr>
<?
for($i=$Page_Start; $i<$Page_End; $i++)
?>
<tr>
<td width="400" align="center"><div align="center"><?=$session_check["ID"][$i]; ?></div></td>
<td width="400" align="center"><?=$session_check["USER_ID"][$i];?></td>
</tr>
<?
?>
</table>
<table width="800" border="0" cellpadding="0" cellspacing="0" style="font-size: 12px; font: Tahoma">
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center">Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :</td>
</tr>
<tr>
<td align="center">
<?
if($Prev_Page)
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
else
echo "<b> $i </b>";
if($Page!=$Num_Pages)
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
?>
</td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
</body>
</html>
Similar Messages
-
PHP- Oracle not working- Call to undefined function OCILogon() ERROR
Hi,
I am trying to just do a test program to test php - oracle connection,
My versions are: php5.2.1-Win32 and Oracle 10g
I have made the following settings:
1.) Uncommented the following lines in php.ini:
extension=php_oci8.dll
extension=php_oracle.dll
2.) Set extension_dir = "C:\php-5.2.1-Win32\ext"
Changed the httpd.conf file as: ADDED
1.)LoadModule php5_module C:/php-5.2.1-Win32/php5apache2.dll
2.)PHPIniDir "C:/Program Files/Apache Group/Apache2/conf-"
3.) LoadFile "C:/php/php5ts.dll"
4.)<IfModule php5_module>
<Location />
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
5.) AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
But when I am tryin to run the following program:
<?php
echo "<h1>OCI Test</h1>\n";
$conn=OCILogon("system", "sheetal16", "orcl");
$stmt = OCIParse($conn, "SELECT table_name FROM user_tables ORDER BY table_name");
OCIExecute($stmt, OCI_DEFAULT);
while (OCIFetch($stmt)) {
$table_name = OCIResult($stmt, "TABLE_NAME");
echo "$table_name<br />\n";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>
I am getting the following error:
OCI Test
Fatal error: Call to undefined function OCILogon() in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 3
Please help me to solve this problem.
Thanks,
SheetalSee Re: PHP- Oracle not working- Call to undefined function OCILogon() ERROR
-
Errors in PHP/Oracle article
Hi,
There are a few errors in the article dealing with PHP/Oracle located at http://otn.oracle.com/oramag/webcolumns/2003/techarticles/hull_php.html
In the listing for the section called "How to use a database":
- $mycursor ora_open ($conn);
should be
$mycursor = ora_open ($conn);
- echo "RESULT: ora_getcolumn ($mycursor, 0), ora_getcolumn ($mycursor, 1) <br>";
The above is not the way it works in PHP and you won't get the expected results. You can throw variables in between your double-quote delimited strings, but not function calls. You'll have to concatenate the function calls like this:
echo "RESULT: ".ora_getcolumn ($mycursor, 0).", ".ora_getcolumn ($mycursor, 1)."<br>";Leendert:
Thanks for the comments. The first one is an obvious typo. The second
is a pretty obvious mistake which I missed while reviewing this. Although
PHP will expand variables in a string like that, it will not handle
function calls. How could it. I just tried it, and concatenation works
just as you suggest. Thanks for the corrections, and we updated the
article.
Sean -
Php, oracle connectivity.
Hello All,
I have a webserver that has php4,apache1.3 and oci8 instant client installed, and have a seperate oracle 10g db server, the php-oracle connectivity is fine when i run php code from db server but it gives me connectivity error when it runs from web server, error " ocifreestatement(): supplied argument is not a valid OCI8-Statement resource in /apache/htdocs/.....php on line..." while even when i made telnet to my db server 1521 port from web server it shows that listener is working, any idea ? thanksHello,
My developers have changed all the API´s to OCI8 and the code is able to connect with oracle 10g with php4 but, i am still getting this warning .i.e
Warning: ocifreestatement(): supplied argument is not a valid OCI8-Statement resource in /apache/htdocs/English/tender_list.php on line 340
i am unable to figure it out, every thing is working fine but still i am getting it ?
thanks -
Where to find documentation related to php-oracle
Hi , i have been working with oracle ,and with php -mysql but never with php-oracle. I would like to ask if there are any samples application with orale-php and wich i can download.
Another question is wich editor is better to use to program codes? I have been using dreamweaver. What else can you suggest me?
Thanks in advanceYou can start with Oracle Underground Manual:
http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf
I also wrote a book on the topic, available from Amazon. -
While using multilanguage in php/oracle iam facing some issues
i gave input as : Portuguese: O próximo vôo à
and got output as : Portuguese: O pr?ximo v?o ?
for some special characters it is replaced by '?' mark.
iam using php5 and orcle 9 and OCI for connecting.
i gave NLS_CHARACTERSET as UTF8
and the unicode datatype as NVARCHAR2(100)
Plz some one help me out in solving ithi..
using alter session in php i changed my nsl_lang to PORTUGUESE
but still the data is stored in ? for some special characers
Array
[PARAMETER] => Array
[0] => NLS_LANGUAGE
[1] => NLS_TERRITORY
[2] => NLS_CURRENCY
[3] => NLS_ISO_CURRENCY
[4] => NLS_NUMERIC_CHARACTERS
[5] => NLS_CALENDAR
[6] => NLS_DATE_FORMAT
[7] => NLS_DATE_LANGUAGE
[8] => NLS_CHARACTERSET
[9] => NLS_SORT
[10] => NLS_TIME_FORMAT
[11] => NLS_TIMESTAMP_FORMAT
[12] => NLS_TIME_TZ_FORMAT
[13] => NLS_TIMESTAMP_TZ_FORMAT
[14] => NLS_DUAL_CURRENCY
[15] => NLS_NCHAR_CHARACTERSET
[16] => NLS_COMP
[17] => NLS_LENGTH_SEMANTICS
[18] => NLS_NCHAR_CONV_EXCP
[VALUE] => Array
[0] => PORTUGUESE
[1] => AMERICA
[2] => $
[3] => AMERICA
[4] => .,
[5] => GREGORIAN
[6] => DD-MON-RR
[7] => PORTUGUESE
[8] => UTF8
[9] => WEST_EUROPEAN
[10] => HH.MI.SSXFF AM
[11] => DD-MON-RR HH.MI.SSXFF AM
[12] => HH.MI.SSXFF AM TZR
[13] => DD-MON-RR HH.MI.SSXFF AM TZR
[14] => $
[15] => AL16UTF16
[16] => BINARY
[17] => BYTE
[18] => FALSE
Input i gave : próximo vôo à
out put : pr??ximo v??o ?? -
PHP Oracle editor/administration
Jeg har installeret Oracle XE og PHP og det går helt fint, men jeg kunne godt tænke mig en PHP-Oracle editor/administrator. Jeg har før brugt PHPMyadmin mellem PHP og Mysql og mener at der findes noget tilsvarende til Oracle, men kan ikke umiddelbart finde det. Er der nogen der kan hjælpe.
HBCHi, pbarut I modified the settings of browsers and added the html code below:
<?php
header("Expires: Thu, 17 May 2001 10:17:17 GMT");
header ("Last-Modified: Thu, 17 May 2001 10:17:18 GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
?>
But the problem continues.
When I update the site (CTRL + F5) results viewing, but do not appear when the redirect or click any link.
Tanks -
hi,
you think that i have a one textbox and one button on my webpage, and i want to write ORacle code in textbox something like that
begin
dbms_output.put_line ('hello!');
end;
after that when i click on the button , i want to display result below.i am using php code to do that things. otherwise i am using oracle 10g express edition,i searched on the net ,and i find a website that exactly what i want to do. this website URL : http://193.140.164.123:5561/isqlplus/login.uix you can enter 'hr' for both username and password. there you can see Workspace.
pls.if u know about this topic write here. thx.That's a pretty open ended question. Perhaps reading the OCI8 manual http://us.php.net/manual/en/book.oci8.php or getting one of the many fine PHP Oracle books will help get you started.
-
est-ce que vous avez un manuel php oracle en français
As this is english forum can you post your question in english please?
French PHP documentation is here: http://www.php.net/manual/fr/ . Oracle functions and examples are included there. -
Free web hosting for PHP Oracle
Hi,
I am a senior student and I have my final year project.For that I am suing PHP and Oracle.Is there anyone who could advise me on a good web hosting site for student aplications available if not for free,at least for a low price for my Oracle database and website.
Note that the website I am building will not be used for comercial purposes, only for education.I will deeply apreciate any help I can get.
Thank youHiya,
Being the sales Director for PHP Oracle Hosting I am proud to say that we do provide high quality of service at the cheapest prices. Our IT guys are professional consultants and are available almost 24hours
www.phporaclehosting.com -
[질문] unix 에서 php와 oracle 10g 를 연동하고 있는데요 한글데이터가 ? 로 나와요
os : unix AIX 5
db : oracle 10g
웹 : apache, php
이렇게 구성되어 있는데
oracle, php 설치를 했는데요
웹은 뜨는데
쿼리를 해서 한글 데이터를 조회하면 한글이 ?(물음표)로 조회가 됩니다.
sqlplus 로 접속해서 보면 한글로 제대로 나오는데 php로 웹상에 보여질때는 한글이 물음표(?)로 나오는데 어떻게 해야 하나요?
인터넷 검색해서 보면 euc-kr 이런 한글 옵션이나 nls 이런 옵션을 맞추면 된다고 하는데 이것저것 해봤는데 안되서 이렇게 글을 올립니다. 오라클 설치시 옵션을 잘못 줘서 그런거지 아니면 php를 설치를 잘못 한건지 정말 모르겠습니다. 고수님들 많은 조언 바랍니다.charater set을 확인해 보세요 5601 또는 949,,,,
949가 디폴트로 알고 있네요 기억이잘;;
글 수정:
user612568 -
all.
We have oracle 9i release 2 databse installed and acced by clients using Forms 6i.
Due to some reasons we are shifting to Oracle 10g rel 1 and PHP as front end.
The new server machine has windows 2000 professional with service pack 4.
i installed orcl 10g rel1 on it. I configured the PHP and place the application pages on the folder and it is workign fine.
Now the problem is that when i try to access the application from my computer it shows me the error as
"Database connection error." This error is hardcodded by me , if there is any issue in connectivity , i have hardcoded that my user will see this error.
a few of the clients when they type the machine name on thier browsers see this error
" PHP Warning: Unknown(): Unable to load dynamic library './extensions/php_oci8.dll' - Access is denied. in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './extensions/php_oracle.dll' - Access is denied. in Unknown on line 0 "
My database clients werent also connecting but the following action has caused the fault to be corrected.
wat i did was that i replace the
host=(endsys.eapa.com)
to host= (ip address).
But still i am unable to connect to the application via my webbrowser.
I have installed PHP correctly, IIS correctly,
may b there is anything to do with the permissions.
Kindly suggest something so that i may able to bring up the application
RegardsHi: Im running IIS on a Windows Server 2000, PHP Version 4.4.2 and I have installed on the same server my Oracle 9 DB.
I have edited php.ini like:
extension_dir = "C:\PHP4\extensions"
extension=php_oci8.dll
I have run dependency walker in order to ensure all dependencys are ok.
I have granted full access to Everybody to the PHP directory
But im having the following error:
PHP Warning: Unknown(): Unable to load dynamic library 'C:\PHP4\extensions\php_oci8.dll' - Access is denied. in Unknown on line 0
Does anybody know where i should start troubleshooting this?
Thanks, Lautaro Dolberg -
OpenSUSE 11.1 (x86_64) Apache2 PHP Oracle !oci_connect
Hi all,
can't connect to an oracle instance oci_connect()
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and LD_LIBRARY_PATH are set and point to the right directories in /srv/www/htdocs/ora/index.php on line 3
System:
openSUSE 11.1 (x86_64)
PHP Version 5.2.11
OCI 1.4.0 Alpha $Revision: 1.269.2.16.2.38.2.32 $
Compile-time ORACLE_HOME: opt/oracle/product/10.2.0/db_1
Libraries Used: -Wl,-rpath,/opt/oracle/product/10.2.0/db_1/lib -L/opt/oracle/product/10.2.0/db_1/lib -lclntsh
set | grep ora
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/10.2.0/db_1
ORA_ASM_HOME=/opt/oracle/product/10gR2/asm
ORA_CRS_HOME=/opt/oracle/product/10gR2/crs
PATH=/home/user/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/opt/novell/ncl/bin:/opt/oracle/product/10.2.0/db_1/bin
decorate diff-filter=
Does anyone has an ideer why the connection can't established.
Best regards
Tillsorry....
Workaround: add the apache user to the oracle group. This only occurs
in 5.2.1. Previous versions of PHP which I've tried (5.0.3 and 5.1.0)
did not have this problem. Obviously this is a security issue as the
apache user now has a lot more things it can use to wreak havoc. -
PHP/Oracle Web Application Framework
Hi,
for people hopping on the Oracle/PHP bandwagon, there's a PHP object oriented Web Application framework that supports Oracle 8.0.5, Oracle 8i, 9i and 10G.
It's called 'Achievo ATK' and can be found on http://www.achievo.org/atk
It makes developing a webinterface to an existing Oracle database pretty easy. It boils down to creating PHP classes around the tables, defining the relationships, and an application to manipulate the data (crud) is generated dynamically by the framework.
To give an example, a complete employee administration application for the 'emp/dept' tables from the scott schema is as much code as:
<?php
userelation("atkmanytoonerelation");
class employee extends atkNode
function employee()
$this->atkNode("employee");
$this->add(new atkAttribute("empno", AF_AUTOKEY));
$this->add(new atkAttribute("ename",
AF_SEARCHABLE));
$this->add(new atkManyToOneRelation("deptno",
"scott.department",
AF_SEARCHABLE));
$this->setTable("emp");
?>
<?php
class department extends atkNode
function department()
$this->atkNode("department");
$this->add(new atkAttribute("deptno", AF_AUTOKEY));
$this->add(new atkAttribute("dname",
AF_SEARCHABLE));
function descriptor_def()
return "[dname]";
?>The demo application that can be downloaded contains basic emp/dept examples, including the ability to edit a departments employees etc. A slightly different version (including manager link etc.) of the dept/emp example can be found on http://www.achievo.org/atk/demo, lesson 2 in the demo's menu.Thanks for letting us know.
-- CJ -
PHP & ORACLE Connectivity on Solaris
Hi all,
You can check this site for PHP and Oracle connection tutorial. It is intended to installing Apache and PHP with Oracle support and connecting and using Oracle via PHP.
Page URL :
http://gokmen.selcuk.edu.tr/tutor/orasol/ociphp.php
Additionally, You will see an alternative way escaping from ORA-12154 and ORA-12545 errors while Oracle connection via PHP.
Hope you find useful...
Mustafa GOKMENHello,
My developers have changed all the API´s to OCI8 and the code is able to connect with oracle 10g with php4 but, i am still getting this warning .i.e
Warning: ocifreestatement(): supplied argument is not a valid OCI8-Statement resource in /apache/htdocs/English/tender_list.php on line 340
i am unable to figure it out, every thing is working fine but still i am getting it ?
thanks
Maybe you are looking for
-
Custom infotype creation issue
Hi Experts, I have a requirement to create a custom infotype based on certain conditions. But there is a problem while saving data in the infotype. The infotype is populated from another infotype automatically through dynamic actions. But while savin
-
Printing after 10.6.8 Update
Hello. I've searched around for this problem and while I've found some that are similar, I haven't been able to find an answer. I'm hoping someone can help me. I work at a high school, and we have a HP Laserjet M2727nf printer that is attached to a
-
Performance issue with custom IDOC download into SAP MII
Hi, We have a custom IDOC which has ten fields. We take the data from these ten fields and insert into database. The issue is we have some where around 4500 idocs flowing into SAP MII and then from SAP MII to sql database. The time taken for these id
-
Aggregator Slide Numbering (Captivate CPT 5.5)
Aggregator seems to work fine. Two things I noticed, one of which is a question: The CPT movie fills the (webpage) screen at first but when all the individual SWF of the aggregated project finish downloading the CPT movie "shrinks" to the development
-
Automatic trimming of blank spaces
Hello, I noticed that Oracle Forms will remove all blank spaces from a text field automatically (if the text field contains only blank spaces). Is this controlled by a specific setting ? Thanks