atmoth Posted March 12, 2007 Share Posted March 12, 2007 hello, i am trying to write a script that pulls one row of data from a database table and lists each cell of data in a different <td>. i have tried a few things such as mysql_result() but have had no luck. does anyone have any solutions to my problem?thanks,atmoth Link to comment Share on other sites More sharing options...
Mr_CHISOL Posted March 12, 2007 Share Posted March 12, 2007 Hi!You could use mysql_fetch_assoc(), which basicaly is the same as mysql_fetch_array( $result, MYSQL_ASSOC ). while ($row = mysql_fetch_assoc( $result )) { echo "<tr>\n"; echo ' <td>'.$row['id']."</td>\n"; echo ' <td>'.$row["field1"]."</td>\n"; echo ' <td>'.$row["field2"]."</td>\n";} If you just want one row, remove the while-statement, but keep $row = mysql_fetch_assoc( $result ) Hope that helpedGood Luck and Don't Panic! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now