I have this command:
$result = $db->Execute("select id,name,description,requirements,display_condition from works order by id");
And I want to insert < td >
INSIDE of the command, that way it enters all of the above select information into a table box.
I tried inserting echo "< td >";
right before the command, but it only creates ONE table box.
Screenie displaying my code and what is happening:
You need to execute something like this:
echo "<table border='1'>";
$query = 'SELECT id, name, description, requirements FROM works ORDER BY id';
$rows = $db->query($query, PDO::FETCH_OBJ);
while( $entry = $rows->fetch() ) {
echo "<tr>"
."<td>".$entry->id."</td>"
."<td>".$entry->name."</td>"
."<td>".$entry->description."</td>"
."<td>".$entry->requirements."</td>"
."</tr>";
}
echo "</table>";
This code allows to populate the data from the DB into a table.
BTW, if you have to skip some rows in the DB by analyzing the "display_condition" field, you would better do it in the SQL query. (I mean in the "$query = ..." line)