Hy guys how can I go through each column of a result returned form the database.

In other words do this:

$command = "SELECT * FROM Persons";
$result = mysql_query($command);
while($row = mysql_fettch_array($result))
{
[INDENT]foreach($column in $row)
{
[INDENT]if($column!=null)
{
...
}[/INDENT]
}[/INDENT]
}

How to do the red part?

Recommended Answers

All 2 Replies

foreach ($row as $name => $value) { }

But if you do I recommend using mysql_fetch_assoc instead.

foreach ($row as $name => $value) { }

But if you do I recommend using mysql_fetch_assoc instead.

Perfect! Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.