gibigbig Posted April 8, 2010 Share Posted April 8, 2010 $datagib = mysql_query("SELECT * FROM sotw ORDER BY id DESC") or die(mysql_error()); $infogibs = mysql_fetch_array( $datagib ); echo "<table>"; foreach ($infogibs as $infogib) { echo "<tr> <td>".$infogib->id."</td> <td>".$infogib->username."</td> <td>".$infogib->profile_link."</td> <td>".$infogib->category."</td> <td>".$infogib->week."</td> <td>".$infogib->link."</td> <td>edit</td> <td>delete</td> </tr>"; } echo "</table>"; ?> is the anything wrong with this, the output is : edit delete edit delete edit delete edit delete edit delete edit delete edit delete edit delete edit delete edit delete edit delete edit delete Link to comment https://forums.phpfreaks.com/topic/198010-is-there-anythign-wrong-with-this-code/ Share on other sites More sharing options...
leehanken Posted April 8, 2010 Share Posted April 8, 2010 mysql_fetch_array only reads one row at a time, rather than all the rows at once also the result is an array rather than an object so [ ] are used rather than -> I think you mean... $datagib = mysql_query("SELECT * FROM sotw ORDER BY id DESC") or die(mysql_error()); echo "<table>"; while($infogib = mysql_fetch_array( $datagib )) { echo "<tr> <td>".$infogib[id]."</td> <td>".$infogib[username]."</td> <td>".$infogib[profile_link]."</td> <td>".$infogib[category]."</td> <td>".$infogib[week]."</td> <td>".$infogib[link]."</td> <td>edit</td> <td>delete</td> </tr>"; } echo "</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/198010-is-there-anythign-wrong-with-this-code/#findComment-1039046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.