Help with PHP and query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gammaman
Forum Commoner
Posts: 45
Joined: Tue Feb 12, 2008 9:22 am

Help with PHP and query

Post by gammaman »

When I execute the following query and print_r the result, I get a resource #id 4 error

Code: Select all

if($id == "contract"){
	
$itemNum = $_POST['itemNo'];
foreach($itemNum as $key=>$value) {
    if (!empty($value)) {
     $item[] = $value;
  }
    }
$itemC = count($item);   //this has a count of 1
print_r($itemC);    // 1
print_r($item);    // [0] > 1009
for($i=0;$i<$itemC;$i++)
{
$contrAmt = oci_parse($conn, 'select contrAmt from tosupply where contractNum = '.$_SESSION['contr'].' AND itemNo = '.$item[$i].' ');	

print_r($contrAmt);   //get a resource error,   should be seeing result of query  
}


User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Help with PHP and query

Post by requinix »

oci_parse doesn't actually run the query. You need oci_execute for that.
Post Reply