PHP and oracle problem
Hi,
I'm trying to create a chart with php ad oracle. I'm using this code
<?
function Num_of_Rows($column, $status, $table){
$conn = oci_pconnect("$username", "$passwd", "$host");
$sql_query = "SELECT COUNT($column) AS NUMBER_OF_ROWS FROM $table WHERE Status = '$status'";
$stmt= oci_parse($conn, $sql_query);
oci_define_by_name($stmt, 'NUMBER_OF_ROWS', $number_of_rows);
oci_execute($stmt);
oci_fetch($stmt);
return $number_of_rows;
$result1 = Num_of_Rows("Admin_Number", "Active", "AS_ADMINS");
$result2= Num_of_Rows("Admin_Number", "Locked", "AS_ADMINS");
echo $result1;
echo $result2;
?>
This code works but only once! When I delete the row $result1 = Num_of_Rows("Admin_Number", "Active", "AS_ADMINS"); the second call of the function works and when I delete $result2= Num_of_Rows("Admin_Number", "Locked", "AS_ADMINS"); the furst call of the function works!
It seems that I can use the function only once and I can't call it again. It seems that the problem is someone else. Do you have an idea?
I don't know what you mean by "works".
Have you tried changing the echo commands so the output is not adjacent?
echo $result1 . "<br>\n";
echo $result2 . "<br>\n";It seems odd to allow an arbitrary tablename but assume that there is always a column called STATUS.
I'd recommend using bind variables where possible.
Similar Messages
-
Hi every ones:
I'm develop some applications using PHP and Oracle and php give me a lot of advantage. in bouth way of access to a database, OCI and mod plsql.
How can i say to Oracle THANKS FOR TAKE SERIOUS PHP TECNOLOGY!!!
I work actually for a company that implement all (Microsoft) and i want find a job with PHP and Oracle programming. Any body have idea that where i need look?How can i say to Oracle THANKS FOR TAKE SERIOUS PHP
TECNOLOGY!!!You just did! Thanks!
You can help Oracle with scripting languages even more, by completing the questionnaire on scripting langauges at:
http://www.oracle.com/go/?&Src=1545492&Act=10
Alison -
Hi everyone,
Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code?All of the public documented Workflow Engine PL/SQL APIs and Java APIs enable customers to build their own screens based on workflow, such as building your own specialized worklist.
Hi everyone,
Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code? -
Please help to connect to oracle through php.
OS=Windows Server 2008 R2(x64)= is working correctly
PHP ver=PHP 5.3.2= is working correctly
ORACLE = Oracle Database 11gR2= is working correctly
Since the PHP and Oracle on the same machine, I did not install install client(but even with instan client I could not connect to oracle).
phpinfo does not show oci section
in Environment section shows these values
PHPRC = C:\Program Files (x86)\PHP\
LD_LIBRARY_PATH = D:\ipardb\ora_base\product\11.2.0\orahome\lib
NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
ORACLE_HOME = D:\ipardb\ora_base\product\11.2.0\orahome
ORACLE_SID = iparbio
Path= C:\Program Files (x86)\PHP\;D:\ipardb\ora_base\product\11.2.0\orahome\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.1\bin;
TNS_ADMIN= D:\ipardb\ora_base\product\11.2.0\orahome\network\admin
Loaded Configuration File C:\Program Files (x86)\PHP\php.ini
uncommented extension in php.ini
[PHP_OCI8_11G]
extension=php_oci8_11g.dll
extension dir is set ok, since other extensions are working properly
when i execute php.exe, in error_log file appears
[11-Jun-2010 10:37:34] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
Please help me.I'm guessing the cause is probably the same as that article: PHP is 32bit but your Oracle libraries are 64bit.
You will need to install 32bit instant client and make sure they are used for Apache. Does Windows 2008 have sym links? Perhaps the note mentioned at the end of OCI8 IN WINDOWS SERVER 2008 x64 will help. Otherwise try creating some batch scripts to set PATH appropriately before starting Apache. -
DW9, PHP, and Oracle
We've just installed DWCS3 and now our Oracle (Oracle Thin
Client) database connections are no longer available with DWCS3. We
have just learned that DWCS3 will not work with Phakt and that PHP
now only supports MySQL. Dropping Phakt without any PHP-to-Oracle
alternatives is a serious threat to our continued use of Adobe web
products because TCO / ROI concerns, facing the fact we may have to
rebuild our websites.
We need to continue to use PHP to access our Oracle dBs. Does
anyone have any recomendations for a work-around to this sorry
behavior?All of the public documented Workflow Engine PL/SQL APIs and Java APIs enable customers to build their own screens based on workflow, such as building your own specialized worklist.
Hi everyone,
Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code? -
Re: PHP and Oracle Connection
Are any specific links that will give me all knowledge regarding php and oracle connection? I am a new babie in this please help me out.
Hi,
I'm looking for specialists in PHP, Ajax and Oracle BPEL...
Pages are: Praxisbörse und Jobs für Arzt und Zahnarzt http://www.praxis-welt.de für Praxisangebote und Jobangebote für Ärzte
sowie auf http://www.berlin-umzug.net für Umzugsunternehmen aus Berlin für Umzüge, Klaviertransport und Tresortransport in Berlin.
Any ideas / information / knowhow?
Regards,
Mic -
Hi.I' m working in an application using php for web development and oracle for server database.My question is until now I found many links about this subject also many books about oracle,plsql and many books about php but I can't found a book about php with oracle and plsql.So my question is are there books about php and oracle?
Thanks in advance thrylosI have seen one in my local book shop, not sure about Internet though.
-
Need help solving listener and Oracle problems with Mac OS X 10.4 "Tiger"
I have Oracle 10g working on Mac OS X 10.4 "Tiger" except for the listener and Oracle net 8 configuration. I have not been able to get the Oracle listener to work with my built in Mac Airport wireless network card or built in ethernet card. I keep getting the errors
connection refused cannot start listener. Can anyone offer help?
Thanks
Ben
[email protected]Hi Ben,
how does your listener.ora look like ?
Mine is:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ronald-g4-eth)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ronald-g4-wifi)(PORT = 1521))
and listens to the ethernet and airport address.
When do you get the problems ?
regards,
Ronald
http://ronr.nl/unix-dba -
Is my configuration correct? PHP and Oracle HTTP server
Hi all,
I have a single server running RHEL5 x86-64 and Oracle 11.1. I also have the Oracle HTTP Server which purportedly has "PHP support".
I am trying to do a basic test connect to my database, but I'm getting an error.
My test is the following:
<html>
PHP Test with Oracle<head>
<body>
<pre>
<?php
$conn = oci_connect('scott', 'tiger', 'myserver/MYDBSERVICE');
if (!$conn) {
trigger_error("Could not connect to database", E_USER_ERROR);
?>
</pre>
</body>
</html>When I open the page, I see the following:
PHP Test with Oracle
Fatal error: Call to undefined function: oci_connect() in /u01/app/oracle/product/HTTP_Server/ohs/htdocs/phptest/dtest4.php on line 6
I've also tried phpinfo() and get the following:
oci8
OCI8 Support enabled
Revision $Revision: apache_modules/mod_php/4.3.9/ext/oci8/oci8.c#0 $
Oracle Version 10.1
Compile-time ORACLE_HOME /ade/svadugur_mjoyphp4311/oracle
Libraries Used no value
Any idea what may be going on? I've looked through much documentation already before posting to no avail.
Thank you for any insight.The oci_* names were introduced in PHP 5. In PHP 4 the equivalent connection command is ocilogon(). For other mappings see Appendix C of the free book http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
I'd recommend you upgrade PHP. See "Installing OCI8 with Oracle Application Server on Linux" on p 76 of that book. Note the warnings. -
Dreamweaver 8, PHP, and WebDAV problems
I'm not sure where else to post this but maybe some of you
folks out
there might know the answer.
My web server, running IIS 6, supports both Coldfusion and
PHP. I've
recently enabled WebDAV for two dreamweaver users who want to
transfer
files securely using the check-in/check-out/sync processes
built into
dreamweaver.
Unfortunately, they are unable to retrieve any PHP files. I
had the
same problem, I tried to sync the entire web site and all the
html and
image files came down fine, but ALL of the php files
generated the
following error:
/development/index.php - error occurred - An HTTP error
occurred -
cannot get index.php. Access Denied. The file may not exist,
or there
could be a permission problem.
File activity incomplete. 1 file(s) or folder(s) were not
completed.
Files with errors: 1
/development/index.php
the IIS log file shows an HTTP response code of 200 - no
error.
The file DOES exist, and the permissions are exactly the same
on all the
files, because I manually set the permissions on the web root
and had it
apply to all subfolders and files.
I can't figure out why it's failing to retrieve the PHP
files...
RickSounds like a MS IIS problem. See if this TechNote helps:
Configuring WebDAV in IIS for use with Dreamweaver
http://www.adobe.com/go/19095
It has some general IIS/WebDAV tips that might help. For the
problem
you're seeing, make sure to disable mappings for PHP, CFM,
ASP, etc.
Hope this helps,
David Alcala
Adobe Technical Support -
Apache, PHP, and Oracle 11G
Hi,
I have an 11G RAC Setup, and a separate application server that runs php that is presently connecting to MySQL Servers.
I just configured OCI8 in my application server and can see that my configurations are correct using phpinfo().
iam using this code to connect to my RAC 11G:
<?php
if(!$conn = oci_connect('sys', 'opensesame','callbox.oracle'))
$err = oci_error();
trigger_error('Could Not Establish a Connection:'.$err['message'], E_USER_ERROR);
?>
but i get this error:
Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/html/oraconn.php on line 6
here's tnsnames.ora in my RAC, using sqlplus via command line works perfectly fine in either nodes of the rac.
LISTENERS_CALLBOX =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node02-vip)(PORT = 1521))
CALLBOX2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node02-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = callbox.oracle)
(INSTANCE_NAME = callbox2)
CALLBOX1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node01-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = callbox.oracle)
(INSTANCE_NAME = callbox1)
CALLBOX =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node02-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = callbox.oracle)
am I missing something?i forgot to include that the tutorial that helped me configure the OCI8 for PHP suggests that i need to create tnsnames.ora in /etc like this:
SERVICENAME =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip_of_oracle_server)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SID)
(SID = SID)
so I created this:
CALLBOX1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.50.161)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = callbox.oracle)
(INSTANCE_NAME = callbox1)
and did this: export TNS_ADMIN=/etc/
am not sure which part of my tnsnames.ora in the RAC (posted earlier) be copied in /etc/tnsnames.ora in the application server. -
and I've tried several ways and does not connect, I vote errors like this
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in C:\xampp\htdocs\conexion oracle\consulta.php on line 4
array(4) { ["code"]=> int(12154) ["message"]=> string(65) "ORA-12154: TNS:could not resolve the connect identifier specified" ["offset"]=> int(0) ["sqltext"]=> string(0) "" } Conexion es invalida
almost always all errors have to do with the oci8 funsiones
I appreciate the help you could provideORA-12154 ALWAYS only occurs on SQL Client & no SQL*Net packets ever leave client system
ORA-12154 NEVER involves the listener, the database itself or anything on the DB Server.
ORA-12154 occurs when client requests a connection to some DB server system using some connection string.
TNS-03505 is thrown by tnsping & is same error as ORA-12154 thrown by sqlplus or others.
The lookup operation fails because the name provided can NOT be resolved to any remote DB.
The analogous operation would be when you wanted to call somebody, but could not find their name in any phonebook.
The most frequent cause for the ORA-12154 error is when the connection alias can not be found in tnsnames.ora.
The lookup operation of the alias can be impacted by the contents of the sqlnet.ora file; specifically DOMAIN entry.
So post the content of the sqlnet.ora file.
TROUBLESHOOTING GUIDE: ORA-12154 & TNS-12154 TNS:could not resolve service name [ID 114085.1]
http://edstevensdba.wordpress.com/2011/02/26/ora-12154tns-03505/ -
Help with SL Server PHP and Oracle ?
(my apologies for post to wrong forum first)
I'm attempting to add oci8/instantclient to the "out-of-the-box" php distribution w/o recompiling (if at all possible)
have installed instantclient in /usr/local
installed oci8 from pecl and built w/instantclient
I THINK my main issue is adding the DYLIB- envt variables because I cannot find a reference to the required XML syntax
Has anyone got this bad boy working?Assuming you installed the Oracle Instant Client correctly, then try this as root (or issue sudo -s before):
mkdir -p /SourceCache
cd /SourceCache
curl -O http://www.opensource.apple.com/source/apachemod_php/apache_modphp-53/php-5.3.0.tar.bz2
tar xjf php-5.3.0.tar.bz2
cd /SourceCache/php-5.3.0/ext/oci8
phpize
MACOSXDEPLOYMENTTARGET=10.6 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bindatload" ./configure
make
make install
When done, edit/create /etc/php.ini and add:
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so
next issue:
sudo apachectl graceful
with a little luck you are all set.
HTH,
Alex -
Reader, IE8, Win7, and Oracle - Problems saving PDF
Hi there! I have an odd annoying issue. In short, my problem is that I cannot save PDF's generated by Orace in a browser window on my Windows 7 PC. My Windows XP machine does this just fine. Both are using IE8.
My work uses Oracle for a good bit of our tasks. I frequently have to save generated PDF's from the Oracle system. The work flow is like this:
1) Login to Oracle in IE8. Then open Oracle via IE8. This process opens up a Java window that houses the actual Oracle app.
2) Generate file from within Oracle. This opens another IE8 window in which I can choose the format of the file (RTF or PDF). When I click next it will generate the file...if a PDF it will normally open inside the browser window.
3) At this point on my Windows XP/IE8 machine, I can click save and a dialog box opens allowing me to choose location and name for the file. On my Windows 7/IE8 machine, when I click save, nothing happens.
If I change the settings in Reader to dissalow opening the file in the browser (forcing Reader to open), I can navigate to "Save As" and save the file. This just requires several more clicks (and to anyone that has used Oracle, you know that the last thing I need is several more clicks for a task).
I can print fine, so I can use a PDF printer to "save" the file, but again, this is more clicks.
If I navigate to a PDF on the web (I used the IRS as a test), I can save just fine, same as on my XP machine.
I've tried disabling UAC in Win7, doesn't help. I've tried adding my company's Oracle website to the trusted list, doesn't help (PDFs come up in an Unkonwn Zone no matter what I do). I tried manually enabling every item under the security settings of IE8 and it didn't help. I've tried running IE8 as an administrator, didn't help.
Thanks in advance for the help.
Message was edited by: Aegwyn11 - Fixed titleI found a decent workaround (not a true solution)...remove Adobe Reader and install PDF Xchange Viewer instead. Its free and has browser integration that actually works correctly. Looking over this forum, it seems that Adobe Reader has a number of problems with Windows 7...I would have thought that Adobe would have their act together better. I guess I was wrong.
-
Hi...
Our server is Windows server 2003 64 bit on which SAP IDES 6.0 is there.
its working fine. then we have remove Domin through RUN>DCPROMO command so all my user has been removed so i have again created windows users.
after that all my service working fine with Dispatcher.
but when i am trying to logon with SAPLOGON its giving "Application server shutdown" and then Dispatcher service is getting stop.
then i am trying in SQL Plus with Username/Pwd it is giving following error.
"Oracle not available.
Shared Memory realm does not exsist."
i have tried with already available forums but its not working.
Following group are also not available in windows group
ORA_XEP_DBA
ORA_XEP_OPER
SAP_LocalAdmin
SAP_XEP_LocalAdmin
SAP_XEP_GlobalLocalAdmin
i have added in Oracle forum but not helpful so i think windows users can help
Kindly help.> now my oracle is up but not able to login in sap.
Your system is hosed up.
> one is : oraclesri102isql*plus service is not getting started.
That service is not important for a SAP system.
Chintan,
it is not supported to make changes to a domain structure after you installed the system (see the given note). That's why your SAP system is not coming up, all filesystem-, registry and user permissions are invalid.
The only way to resurrect your system is to reinstall it.
Configure first the operating system (as standalone or in a domain) - and then install the SAP system, not vice versa.
Markus
Maybe you are looking for
-
How can I run a script on suspend/resume?
I'd like to run a script when a machine is about to suspend and another after it resumes. Is this possible?
-
Probably a stupid question about upgrades...
I originally bought Adobe CS3 Web Premium and upgraded to CS5.5 Design Premium last year. I'm wondering if I upgrade, will my price be based on the CS3 license or the CS5.5 upgrade...? I'm guessing it will be based on CS5.5, but I want to make sure.
-
1. How can i read every line in a text file and only remove the first word of each line and put it in a new text file. 2. How to read a text file that has numbers and ask it to display the largest, smallest and the average of all the numbers. I'm loo
-
Hi gurus, Its urgent can any one tell me how to see the KE30 report day wise. Regards Dinaker.
-
Hi All I wanted to know how to do the set up for IDOC in a XI System . Would be great if any body can give me the steps involved in configuring the IDOC in XI and R/3 System Any help on this is highly appreciated regards raj