Echo-ing Only Available Database Result
- by Robert Hanson
I have this Associative Array :
$Fields = array("row0"=>"Yahoo ID", "row1"=>"MSN ID", "row2"=> "Gtalk ID");
on the other side, I have this SQL query :
SELECT YahooID, MSNID, GTalkID From UserTable WHERE Username = '$Username' LIMIT 1;
the result maybe vary, because some users only have Yahoo ID and some have others. for example if I have this result :
$row[0] = NONE //means YahooID = NONE
$row[1] = example@msn.com
$row[2] = example@gmail.com
then how to have this as an output (echo) :
MSN ID = example@msn.com
Gtalk ID = example@gmail.com
since Yahoo ID is not exist, then the result will be MSN and Gtalk only. 'MSN ID' and 'Gtalk ID' is variable from Associative Array, while 'example@msn.com' and 'example@gmail.com' from SQL result.
thanks!