Hi tekky,
I tried it and got errors. I made a few changes from:
$sql = 'SELECT `hood`, `booties`, `gloves`, `light`, `camera`, `computer`, `training`, `other` FROM `log` WHERE id=' . $id;
$result = mysql_query($sql) or die('Error in sql: ' . $sql . ' --- ' . mysql_error());
while($row = mysql_fetch_assoc($result))
foreach($row as $key=>$value)
if ($row == 'yes')
echo $key . '<br />';
to
$sql = "SELECT `hood`, `booties`, `gloves`, `light`, `camera`, `computer`, `training`, `other` FROM `log` WHERE id=' . $id'";
$result = mysql_query($sql) or die('Error in sql: ' . $sql . ' --- ' . mysql_error());
while($row = mysql_fetch_assoc($result))
foreach($row as $key=>$value)
if ($value == 'yes')
echo $key . '<br />';
and now it works perfect!
Hi liquorvicar,
I tried your way also, but I get no results. It's just blank. I thought it might of been where I placed the array, but no matter where I move it too I get the same results. Im curious to see your code at work also.
This is what I got:
$q2 = "SELECT * FROM log WHERE id = '32' ";
$r2 = mysql_query($q2) or die(mysql_error());
$columns = array('Hood', 'Booties', 'Gloves', 'Light', 'Camera', 'Computer', 'Training');
foreach ($columns as $column) {
if ($row[$column]=='yes') {
echo($column);
}
}
Thanks for your advice!
I want to thank everyone who has been inputting advice. So far I learned quite a bit, probably more than what I anticipated.
Special Thanks Shout Out to:
liquorvicar
tekky
bradgrafelman
Thank you all!