Page 1 of 1

mysql_field_type returns "blob" instead "date"?

Posted: Fri Dec 11, 2009 1:02 pm
by Rakward
Okay, I wanted to check the datatypes of the rows of the table "users" so that judging from that it automatically creates a input-fields of the right type(text, date, checkbox, ...). However, for the username it returns fieldtype "blob" instead of "string"(which it does for password and email, both set to "text" in phpMyAdmin just like username).
And for the date it also says "blob". All values in these fields are correct.

According to phpnet(about the mysql_field_type function): The returned field type will be one of "int", "real", "string", "blob", and others as detailed in the » MySQL documentation.
http://dev.mysql.com/doc/refman/5.0/en/data-types.html

Date is a valid data-type so ...

Anybody knows what the problem might be?

Code: Select all

<?php
/*
Connection to database and stuff
*/
$body .= '<form name="register" action="/pages/process_reg.php" method="post"><table>';
    for($n=0;$n<=$i;$n++){
        $column = $col[$n];
        if (!(in_array($column, $auto))){ // Create input fields for columns not in the $auto-array
            $type= mysql_field_type($result, $n);           
            $body .= "<tr><td>$column: $type </td> <td><input type=\"text\" name=\"$column\" id=\"$column\"/></td> </tr>";
            if (in_array($column, $confirm)){ // Create confirmation-fields for columns in the $confirm-array
                $body .= "<tr><td>$column (again): </td> <td><input type=\"text\" name=\"$column"."2"."\" /> (confirm the above)</td> </tr>";
                }
            }
        }
       
    $body .= "<tr><td><input type=\"submit\" value=\"register\" /></td><td></td></tr></table></form>";
 
?>
All suggestions/ideas are welcome, wont be able to check/test untill monday, didn't bring a copy of the files home, stupid, I know ...