I’m building this function but I’m not getting the desired output, it’s been more than 5 hours I’m still on this.
I have this code:
$result = mysql_query("SELECT $checked FROM hostess");
echo "<table border='1'>";
foreach( $checked1 as $key => $value){
echo "<th> $value </th>";
while($row = mysql_fetch_array($result)){
foreach($checked1 as $key => $value){
echo "<tr>" . $row[$value] . "</tr>";
}
}
}
echo "</table>";
What I need is to print the first $value as the heads of the table, then the $row[value] as the rows, but I get to print the headings, then the rest just prints in a single line, all of it.
Ok, I understand better now. Your issue is that you’re not printing the tags and values in the right order. Try this: