ShoeLace1291 Posted June 21, 2007 Share Posted June 21, 2007 I got this from the code library, but I don't know how to display it. function GetFieldList($database, $table) { $fldlist = mysql_list_fields($database, $table); $columns = mysql_num_fields($fldlist); for ($i = 0; $i < $columns; $i++) { $Listing[] = mysql_field_name($fldlist, $i); } Return ($Listing); } I want to display the list of fields. Quote Link to comment https://forums.phpfreaks.com/topic/56502-how-do-i-display-this/ Share on other sites More sharing options...
teng84 Posted June 21, 2007 Share Posted June 21, 2007 print_r( GetFieldList($database, $table)); but supply a value for $database $table those parameter are required ASTIG!!!! Quote Link to comment https://forums.phpfreaks.com/topic/56502-how-do-i-display-this/#findComment-279064 Share on other sites More sharing options...
ShoeLace1291 Posted June 21, 2007 Author Share Posted June 21, 2007 Hmm... Any way to display it without the array? Like field1,field2,field3 ? Quote Link to comment https://forums.phpfreaks.com/topic/56502-how-do-i-display-this/#findComment-279068 Share on other sites More sharing options...
sasa Posted June 21, 2007 Share Posted June 21, 2007 try $list = GetFieldList($database, $table); $i = 1; foreach($list as $name) { echo "name of field$i is $name"; $i++; } Quote Link to comment https://forums.phpfreaks.com/topic/56502-how-do-i-display-this/#findComment-279075 Share on other sites More sharing options...
ShoeLace1291 Posted June 22, 2007 Author Share Posted June 22, 2007 I don't understand what you mean... could you explain the code a little bit? Quote Link to comment https://forums.phpfreaks.com/topic/56502-how-do-i-display-this/#findComment-279708 Share on other sites More sharing options...
trq Posted June 22, 2007 Share Posted June 22, 2007 The function returns an array, the above foreach() loops simply loops through and displays the contents of the array. Quote Link to comment https://forums.phpfreaks.com/topic/56502-how-do-i-display-this/#findComment-279709 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.