data not printing out
Posted: Fri Jan 15, 2010 10:04 pm
I have this code that prints out all ethinics a person chooses, I also what it to print out any that was input by the user but I can't figure out how to get it to work - just this part isn't working
the rest works fine.
Here is the full code-
Code: Select all
if ($r['othr_Ethn']) $string .= "$othr_Ethn_txt";Here is the full code-
Code: Select all
$sql = mysql_query("SELECT * FROM ethn WHERE userId = 'kelly'");
while($r = mysql_fetch_array($sql)) {
$string = "";
if ($r['asian']) $string .= "Asian, ";
if ($r['black']) $string .= "Black/African, ";
if ($r['east_indian']) $string .= "East Indian, ";
if ($r['mid_eastern']) $string .= "Middle Eastern, ";
if ($r['hispanic']) $string .= "Latino/Hispanic, ";
if ($r['native']) $string .= "Native American, ";
if ($r['pac_haw']) $string .= "Pacific Islander/Hawaiian, ";
if ($r['white_eu']) $string .= "White/Caucasian, ";
if ($r['othr_Ethn']) $string .= "$othr_Ethn_txt";
$string = rtrim($string, ", ");
echo " $string \n";
}