Jump to content

Using while..list with DB::getInstance()->nextRow()


MrBaseball34
 Share

Recommended Posts

I'm having trouble doing this:

   $niinssql = "SELECT description, nsn, niins_id FROM `niins` WHERE PARTNO = '".$partno."'";
   $niinsresult = Db::getInstance()->Execute($niinssql);
   if($niinsresult) {
   while (list($description, $nsn, $niins_id)=DB::getInstance()->nextRow($niinsresult))
       /*********************************************************
       // do something with $description, $nsn, $niins_id values
       /*********************************************************
     } // while (list($description, $nsn, $niins_id)=DB::getInstance()->getRow($niinsresult))
   } // if($niinsresult)



I'm getting all blank values even though I know there is at least one row.
Can this be done or not?

Share this post


Link to post
Share on other sites

I can get the next row to work, but not using the list syntax for some reason. Try using the following instead:

$niinssql = "SELECT description, nsn, niins_id FROM `niins` WHERE PARTNO = '".$partno."'";
   $niinsresult = Db::getInstance()->Execute($niinssql);
   if($niinsresult) {
   while ($row=Db::getInstance()->nextRow($niinsresult))
       /*********************************************************
       // do something with $row['description'], $row['nsn'], $row['niins_id'] values
       /*********************************************************
     } // while ($row=DB::getInstance()->getRow($niinsresult))
   } // if($niinsresult)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More