Code Comments
Programming Forum and web based access to our favorite programming groups.how can i read a mysql table of two fields and test if the first field has a
value then add the second value to an array
I try this but it doesn't works
while ($row=mysql_fetch_array($result))
{
for ($i=0; $i< mysql_num_fields($result); $i++)
if ($row['CampoChiave']=='true')
$TempArray[ ]=$row['NomeCampo'];
}
Post Follow-up to this messageWhat is the "for" loop for if you do not use it's index ($i)? You are testing if CampoChiave has a string value of 'true'. You wrote that you want to test if it has any value. You may do it like this: if (isset($row['CampoChiave']) && ($row['CampoChiave']!='')) $TempArray[]=$row['NomeCampo']; Hilarion PS.: I do not use MySQL, so my suggestions are general PHP related and may not be sufficient.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.