473,414 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How to connect oracle with php

Hello everyone,

I need to know whether it is posible to make any connection between oracle and php? If so can anyone provide me the code or whatever needed to to my task? That would be very helpful for me.

Thank you ALL
Nov 11 '06 #1
2 1541
boss1
45
hei, u can try this code:

If you are using php to simply connect and select data would require this.

Code: ( php )
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3.  
  4.   $conn = oci_connect('username', 'password', 'database');
  5.   if (!$conn) {
  6.     $e = oci_error();
  7.     echo htmlentities($e['message']);
  8.     exit;
  9.   }
  10.  
  11.   $query = 'SELECT * FROM DEPARTMENTS';
  12.  
  13.   $stid = oci_parse($conn, $query);
  14.   if (!$stid) {
  15.     $e = oci_error($conn);
  16.     print htmlentities($e['message']);
  17.     exit;
  18.   }
  19.  
  20.   $r = oci_execute($stid, OCI_DEFAULT);
  21.   if (!$r) {
  22.     $e = oci_error($stid);
  23.     echo htmlentities($e['message']);
  24.     exit;
  25.   }
  26.   print '<table border="1">';
  27.   while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
  28.     print '<tr>';
  29.        foreach ($row as $item) {
  30.          print '<td>'.($item?htmlentities($item):'&nbsp;').'</td>';
  31.        }
  32.        print '</tr>';
  33.   }
  34.   print '</table>';
  35.   oci_close($conn);
  36. ?>
  37.  
  38.  
Dec 17 '07 #2
amitpatel66
2,367 Expert 2GB
Boss1,

Pleaes make use of [code] tags everytime you post source code in this forum

Thanks
MODERATOR
Dec 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Hari Om | last post by:
Cannot connect as Internal Hello, I am using IBM AIX 5.1L box for Oracle 9.2.0.1. I cannot connect as internal to my DB INstance - wonder why? Here is what is do:...
1
by: DAVID | last post by:
Hello, With regards to the Connect dialog on Oracle forms 6i via which we can connect to Oracle database, should we use the same functionality on forms run time again? I mean, I want to make a...
1
by: CM | last post by:
Hi, when i want connect me in my BD with a JSP (with this simple code), this exception is throw. Thank's for ur help Mathieu CODE of my JSP ---------------------
4
by: Ellen K. | last post by:
Hi all, Being that so far I didn't get an answer to my below problem on the Oracle newsgroup, I figured it couldn't hurt to try here. While at my current job I've been working with mostly SQL...
5
by: jrefactors | last post by:
My machine is Windows XP with Oracle 9.2 Home; IIS and Oracle are in the same box. I have tried both Oracle OLEDB Provider and Microsoft ODBC For Oracle, but both not working. For Microsoft...
6
by: ´ď´ď | last post by:
How to connect asp.net with Oracle Database? Where and How to? Thanks very much.
8
by: danbredy | last post by:
Hi, I'm attempting to connect to an Oracle database using SQL Server 2005 Express (OS is Windows XP Professional) and having absolutely no luck. Here is the information SQL Plus gives me about...
7
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work....
9
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work....
8
by: CJM | last post by:
I have a working web application (ASP) which links to an Oracle 10g DB via OO4O. I'm trying to port it to either of two test servers, but in fact, I can't get it to work with either - 'Unable to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.