http://qdlover.yeah.net
Ò»¸ooracle+PHPµÄ²eѯµÄÀý×Ó
±¾À´ÎÒ²»ÓÃphpÁË£¬¿ÉÊÇ»¹ÊÇÓкܶaÅoÓÑÎÊÎÒ£¬ÎÒ¾Í×oÁËÒ»¸oÀý×Ó,¾ßÌaº¯ÊýÇe²eÊÖ²a
ÆaʵoracleµÄº¯ÊýºÍ±ðµÄÒ²²i²»¶a£¬Ö»²»¹ýËuÕaÀi¶aÁËÒ»¸o¶¨ÒaÊa³o±aÁ¿µÄ¹ý³Ì£¬
Èç¹uѧ¹ýpl/sqlµÄÈ˶¼ÖªµÀµÄ£¨²»¹ýÌý˵ֻÓÐÇa»ªºÍÎ÷°²½»´oÓÃËu×oÍøÕ¾)¡£
¾ÍÊÇOCIDefineByName($id,"ROWNUM",&$rownum);¶ÔÓ¦Á˲eѯÖеÄrownum,Ò»¸o¶ÔÓ¦Ò»¸o£¬
¶øÇÒ×iÓ¦¸Ã×¢ÒaµÄ¾ÍÊÇ£¬ÔÚ¶¨ÒaµÄʱºo£¬×Ö¶ÎÃu±ØÐeÊÇ´oдµÄ£¬ÒoΪoracleÀi²»ÈÏСд
ÆaËuµÄ¾Í²i²»¶aÁË£¬¸³Öµ£¬ÏÔʾ£¬¹Ø±ÕÓαe
$conn = ocilogon("gcxx","gcxx","server1");
$id = OCIParse($conn,"select rownum,gcdjbh,gcmc from zbgg");
OCIDefineByName($id,"ROWNUM",&$rownum);
OCIDefineByName($id,"GCDJBH",&$gcdjbh);
OCIDefineByName($id,"GCMC",&$gcmc);
OCIExecute($id);
$i=0;
while (OCIFetch($id)) {
echo "ÐoºÅ:".$rownum."
";
echo "¹¤³ÌµÇ¼Ç±aºÅ:".$gcdjbh."
";
echo "¹¤³ÌÃu³Æ:".$gcmc."
";
$i++;
if ($i>10) break;
}
OCIFreeStatement($id);
OCILogoff($conn);
?>
£¨³o´¦£ºViphot£(C)