looping through a database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am looping through a database of files that are numbers 1 through 10 if number 1 is in the database I what to print out the first table below if it is not then print the else section below. Then loop through the database to see if 2 through 10 are there and do the same thing. Of course what I am doing does not work. Should I move it all to an array and then loop through it. Or use a foreach loop.
Could you please give me an idea where to start looking

while($row=mysql_fetch_array($sql_result)){

if ($row["number"]==1) {
<tr>
<td> File 1</td>
<td>This is the file</td>
<td>Delete</td>
</tr>
}else{
<tr>
<td>File1</td>
<td></td>
<td>Add</td>
</tr>
}

}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux