|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi
I'm writing a generel function for one of my sites. In that function i need to be able to retrieve the lenght of a MySQL field. eg. if the field is declared with MyName = VARCHAR(50) i need to parse the 50. I use PHP (3) as front-end and i'm retrieving data as follows: $mrQuery = db_query("SELECT fieldValue FROM ".$my_table_name." WHERE fieldName = ".$my_field_name.""); What do i need to do to get the length of "fieldValue"?? Regards // Martin [This message has been edited by kaasgaard (edited May 27, 2000).] |
|
#2
|
|||
|
|||
|
You'll have to use the mysql_list_fields() function as the query:
$result=mysql_list_fields("databasename","tablename"); and mysql_field_len() to get the length: $len=mysql_field_len($result,$field_num); where $field_num is the offset of the field you wish to retrieve. |
|
#3
|
|||
|
|||
|
Works like a charm
![]() Thanx. // Martin [This message has been edited by kaasgaard (edited May 27, 2000).] |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Getting the length of a field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|