473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Field sizeof function


I can find no PHP function that returns the maximum limit of field. For
instance, when I see "varchar(256)" for the specification of a field, it's
the number "256" I am interested in. Or perhaps what I am really
interested in is both the type and the number of bytes a field is allocated
(maximum permitted, not actually maximum used in a table with fields)

So anyone know what MySQL query function I would use to get info on a
field? The object properties returned by PHP function 'mysql_fetch_field'
do not give me what I want.
As to why I want it, I want to set up a dynamic add/edit-data form in an
HTML page with text and textarea controls, the size/maxlength/rows/columns
of which are based on the number of characters allowed to set a value for a
field based on its type and byte size.
Oct 27 '08 #1
1 1576
On Mon, 27 Oct 2008 14:27:30 +0100, Patient Guy
<sevisen.adam@gmaildotherecomwrote:
>
I can find no PHP function that returns the maximum limit of field. For
instance, when I see "varchar(256)" for the specification of a field,
it's
the number "256" I am interested in. Or perhaps what I am really
interested in is both the type and the number of bytes a field is
allocated
(maximum permitted, not actually maximum used in a table with fields)

So anyone know what MySQL query function I would use to get info on a
field? The object properties returned by PHP function
'mysql_fetch_field'
do not give me what I want.
comp.databases.mysql?

SHOW FULL COLUMNS FROM tablename;
DESCRIBE tablename;
As to why I want it, I want to set up a dynamic add/edit-data form in an
HTML page with text and textarea controls, the
size/maxlength/rows/columns
of which are based on the number of characters allowed to set a value
for a
field based on its type and byte size.
You could learn a lot by looking through phpMyAdmin's code.
--
Rik
Oct 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
3
by: Sunil Menon | last post by:
Dear All, A class having no member variables and only a method sizeof(object) will return 1byte in ANSI and two bytes in Unicode. I have the answer for this of how in works in ANSI. But I don't...
2
by: Xiangliang Meng | last post by:
Hi, all. What will we get from sizeof(a class without data members and virtual functions)? For example: class abnormity { public: string name() { return "abnormity"; }
11
by: Bradford Chamberlain | last post by:
I work a lot with multidimensional arrays of dynamic size in C, implementing them using a single-dimensional C array and the appropriate multipliers and offsets to index into it appropriately. I...
42
by: Christopher C. Stacy | last post by:
Some people say sizeof(type) and other say sizeof(variable). Why?
5
by: Fao, Sean | last post by:
I was just thumbing through K&R 2nd Edition and thought I'd read up on bit-fields, which I haven't had much use for in my career. Anyhow, K&R says that, "Fields may be declared only as ints; for...
43
by: Richard | last post by:
Could someone point me to why "sizeof x" is/isnt preferable to "sizeof(x)",
0
by: mathieu | last post by:
Hello, I am trying to use template programing and bit-field and I came up with (*). I was not able to make a really clean solution but instead separate into 3 cases: 1. mask is declare before...
2
by: psujkov | last post by:
Hi everybody, let us have some class A with const static int variable var with compile-time well-known value. let us have some function f(), which has return type of A. and let us have some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.