turbocueca Posted March 18, 2006 Share Posted March 18, 2006 Hello, can someone tell me how can I output all fields of a row in a mysql db using php? and then write. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted March 18, 2006 Share Posted March 18, 2006 If you want to see all of the columns for a table:[code]$query = "SHOW COLUMNS FROM tablename";$result = mysql_query($query);$html = ' <table> <tr>'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($row['Key'] == "PRI") { $primarykey = $row['Field']; } $html .= "<th>" . $row['Field'] . "</th>";}$html .= '</tr> </table>';echo $html;[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.