Re: Problem with Oracle
| From: | Jean-Christophe Le Brun | Date: | Wed, 31 Jan 2001 07:19:25 +0000 |
| Subject: | Re: Problem with Oracle | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5278@lists.php.net to get a copy of this message | ||
Hi !
> I'm trying to run some SQL in Oracle that returns a single value...
>
> $sql_getID = "SELECT max(CUSTID_NUM) from cfull2.tbl_dl_customers";
>
> how the hell do I get that number into a variable?
>
> I've tried a dozen different things, but the documentation is so sparse
and
> it's all about getting rows of data...
Do this :
$Requete = "SELECT max(CUSTID_NUM) MAX_ID from cfull2.tbl_dl_customers";
OCIDefineByName($Requete, "MAX_ID", &$Max_Id);
OCIExecute($Requete, OCI_DEFAULT);
while (OCIFetch($Requete))
{
echo $Max_Id;
}
the While is not necessary here cause your query send only one row...
if (OCIFetch($Requete))
{
echo Max_Id;
}
is better !
JCLB Soft
Jean-Christophe Le Brun
jean-christophe.lebrun@meteo.fr
http://www.multimania.com/jclb