Re: looping through a database

From: Date: Tue, 17 Jun 2008 00:51:50 +0000
Subject: Re: looping through a database
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-275462@lists.php.net to get a copy of this message
Richard Kurth wrote:
Wolf wrote:
Richard Kurth wrote:
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> } }
What is the query being executed? <!-- SNIP -->
This is the query being executed $sql = "SELECT * FROM table WHERE members_id =" . $_SESSION["members_id"]; $sql_result = mysql_query($sql) or die(mysql_error()); That still pretty much tells me nothing.
Does your table named table exist? Does your script connect or error? What DOES output to your screen? Does the schema for your table contain numbers? What happens when you use $row['number']? Or are you just hoping for someone to write your code? As written, your code will fail due to having PHP interspersed with HTML code. As such, you either need to echo or exit out of the PHP areas and then continue. Wolf

« previous php.general (#275462) next »