Voting

: max(eight, six)?
(Example: nine)

The Note You're Voting On

scott at abcoa dot com
23 years ago
Using odbc_fetch_into() is becoming tiresome when it had to be changed in php version 4.0.5, 4.0.6 and 4.2.x. Also, using define() function no longer work well with 4.2.x, so define() is not reliable for odbc_fetch_into(). Time on the job to keep up with the changes is ill-advised. Turned out the better solution is to use odbc_fetch_array and not have to deal with the hassle of updating the database, web pages, etc. It is worth the time in the long run.

--clip-- (old script)
define(CUSTOMER_ID,0);
define(CUSTOMER_NAME,1);

//$rows = 1;

if (odbc_fetch_row($result))
{
//odbc_fetch_into($result,1,&$user_detail); //php 4.0.5
//odbc_fetch_into($result,$row,$user_detail); //php 4.0.6
odbc_fetch_into($result,$user_detail,1); //php 4.2.x
echo $user_detail[CUSTOMER_ID];
} else {
echo "Failed!";
}
--clip--
//#########################################
--clip-- (new script)
if (odbc_fetch_row($result))
{
while($user_detail = odbc_fetch_array($result) ) {
echo $user_detail[CUSTOMER_ID];
}
} else {
echo "Failed!";
}
--clip--

This is pretty useful when we keep adding columns to the database table. If you combine two tables and have two columns with the same column name, then you'll need to have two seperate array, like $user_detail1 and $user_detail2, etc. Whatever you can come up with.

<< Back to user notes page

To Top