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] = [email protected]
$row[2] = [email protected]
then how to have this as an output (echo) :
MSN ID = [email protected]
Gtalk ID = [email protected]
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 '[email protected]' and '[email protected]' from SQL result.
thanks!