Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

simple php-oracle query problem

781646Jun 28 2010 — edited Jul 5 2010
hi all,

i'm new to php oracle. I'm not sure about my query. I try to echo stack of data from a table. However, it will only preview one data. But i'm not sure how to make them view all of my data. My codes is like this:


$conn = oci_connect('abc','abc123','00/sid');

if (!$conn) {
trigger_error("Could not connect to database", E_USER_ERROR);
}

$query = " select * from ANNOUNCEMENTS ";
$stid = oci_parse($conn, $query);
$result = oci_execute($stid, OCI_DEFAULT);
$row = oci_fetch_array($stid, OCI_ASSOC);
$nrows = oci_num_rows($stid);

if (!$nrows) {

No Records!

<?php
}
else
{
?>
<table width="671" border="1" bordercolor="#666666">
<tr>
<td>News</td>
<td>Dates</td>
</tr>
<?php
for ($x = $nrows; $x>0; $x--){
?>
<tr>
<td><?php echo $row["NEWS"];?></td>
<td><?php echo $row["DATE"];?></td>
</tr>
<?php
}
OCIFreeStatement($stid); ?>

please help me out, ;(
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 2 2010
Added on Jun 28 2010
6 comments
5,168 views