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. Link to comment https://forums.phpfreaks.com/topic/5258-mysql/ 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] Link to comment https://forums.phpfreaks.com/topic/5258-mysql/#findComment-18670 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.