Danny620 Posted January 18, 2012 Share Posted January 18, 2012 The Code I Have is This echo '<h3>Table Name: ',$table,'</h3>'; // Make the query: $q = "SHOW COLUMNS FROM $table"; $r = @mysqli_query ($dbc, $q); // Run the query. if (mysqli_num_rows($r) > 0) { // Available. echo '<table cellpadding="0" cellspacing="0" class="db-table" width="100%">'; echo '<tr><th>Use</th><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default<th>Extra</th><th>Type</th></tr>'; while($row2 = mysqli_fetch_array ($r, MYSQLI_ASSOC)) { echo '<tr><td><input name="" type="checkbox" value="" /></td>'; foreach($row2 as $key=>$value) { echo '<td>',$value,'</td>'; } echo '<td><select name=""> <option value="1">Input Field</option> <option value="2">Textbox</option> <option value="3">DropDown List</option> <option value="4">Upload File</option> <option value="5">Checkbox</option> </select></td></tr>'; } echo '</table><br />'; } } and it outputs like this Use Field Type Null Key Default Extra Type quote_id int(15) NO PRI auto_increment what i would like to do is get the max lenth like the output above int(15) buy by using mysqli_fetch_lengths() Link to comment https://forums.phpfreaks.com/topic/255319-how-to-use-mysqli_fetch_lengths/ Share on other sites More sharing options...
Danny620 Posted January 18, 2012 Author Share Posted January 18, 2012 any help? Link to comment https://forums.phpfreaks.com/topic/255319-how-to-use-mysqli_fetch_lengths/#findComment-1309075 Share on other sites More sharing options...
litebearer Posted January 19, 2012 Share Posted January 19, 2012 yours gets the length of the field content; whereas, http://php.net/manual/en/function.mysql-field-len.php = gets the max field length Link to comment https://forums.phpfreaks.com/topic/255319-how-to-use-mysqli_fetch_lengths/#findComment-1309078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.