jeff5656 Posted April 25, 2010 Share Posted April 25, 2010 $query = "SELECT * FROM `people` WHERE `s_status` = 'a' order by $srt"; $results = mysql_query ($query) or die (mysql_error()); while ($row = mysql_fetch_assoc ($results)) { echo $row['f13'] . "this field type is"."?????"; Where the ???? are in the code above, what do I put there to echo the filed type (i.e. "varchar" or "Date", etc? Link to comment https://forums.phpfreaks.com/topic/199711-echo-the-field-type/ Share on other sites More sharing options...
litebearer Posted April 25, 2010 Share Posted April 25, 2010 this may guide you... http://www.java2s.com/Code/Php/MySQL-Database/Getcolumnnametypeandmaxlength.htm Link to comment https://forums.phpfreaks.com/topic/199711-echo-the-field-type/#findComment-1048206 Share on other sites More sharing options...
litebearer Posted April 25, 2010 Share Posted April 25, 2010 Also... http://www.w3schools.com/php/func_mysql_field_type.asp Link to comment https://forums.phpfreaks.com/topic/199711-echo-the-field-type/#findComment-1048207 Share on other sites More sharing options...
jeff5656 Posted April 25, 2010 Author Share Posted April 25, 2010 I apologize I could not undertand how to use the first link: for($count=0;$count<$fields;$count++) { $field = mysql_fetch_field($result,$count); echo "<p>$field->name $field->type ($field->max_length)</p>"; and apply that to my code. what is "field ->type"?? If I have $row['f13'] how do I see what data type that is? Yoir send link: mysql_field_type(data,field_offset) What is a field offset? I do not know what number to start at. Link to comment https://forums.phpfreaks.com/topic/199711-echo-the-field-type/#findComment-1048229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.