This is a discussion on MySQL within the PHP Programming forums, part of the Web Development category; Hello, can someone tell me how can I output all fields of a row in a mysql db using php? ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hello, can someone tell me how can I output all fields of a row in a mysql db using php? and then write. |
|
#2
| |||
| |||
| Hi, Here is a small piece of code that will generate a table with field names as headings and then rows for the data: - <? $qstr = Select * from table_name; $qry = mysql_query($qstr); $flds = mysql_fetc_field($qry); Echo <table border =1>; Echo <tr>; $i = 0; while ($i < mysql_num_fields($qry)) { echo <td> . mysql_fetch_field($qry, $i) . </td>; $i++; } $j = 0; While ($arr = mysql_fetch_array($qyr)) { Echo <tr>; While ($j <= $i) { Echo <td> . $arr[$j] . </td>; $j++; } Echo </tr>; $j = 0; } Echo </tr>; Echo </table> ?> |
|
#3
| |||
| |||
| Quote:
|
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I Can Help With MYSQL | theseokit | Database Support | 9 | 01-21-2009 11:01 PM |
| php-mysql | lekshmy | PHP Programming | 0 | 01-21-2009 10:58 PM |
| Why to use MySQL | Amisha_Sharma | Database Support | 1 | 01-07-2009 07:56 PM |
Our Partners |