[PHP] looping through a database
- Date: Mon, 16 Jun 2008 13:57:49 -0700
- From: Richard Kurth <richardkurth@xxxxxxxxxxxxxx>
- Subject: [PHP] looping through a database
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
- Follow-Ups:
- Re: [PHP] looping through a database
- From: Wolf
- Re: [PHP] looping through a database
- Prev by Date: Re: [PHP] How to prevent DoS on PHP script?
- Next by Date: RE: [PHP] Binary data in $_POST, not in $_FILES, why?
- Previous by thread: [PHP] Binary data in $_POST, not in $_FILES, why?
- Next by thread: Re: [PHP] looping through a database
- Index(es):