Ask a php to check MySQL problem

Source: Internet
Author: User
I used PHP to look up some data from MySQL,
But I want to know the data types of these fields, what to do with them,
I don't know what this SQL is or it's not, it's possible that more than one table or field is calculated.
cannot be retrieved by checking the table field.
There is no way, this I like C #, do not manage what SQL isolated data are band type.
Ask for answers


Reply to discussion (solution)

Mysql_field_type--Get the type of the specified field in the result set
Mysql_field_table--Gets the name of the table in which the specified field is located

PHP is a weakly typed language, and the actual type of data is less important.

Mysql_field_type--Get the type of the specified field in the result set
Mysql_field_table--Gets the name of the table in which the specified field is located



Thank you, indeed available, but there is a problem when in SQL. This field is the result of the calculation, it will return the real type, it is obviously wrong,

For example, select A+b from t
。
This is not a problem in C #.

The appearance of real is because the type of a, B differs.

DOUBLE precision[(m,d)] [UNSIGNED] [Zerofill], real[(m,d)] [UNSIGNED] [Zerofill]

is a synonym for double. In addition to: if the SQL Server schema includes the Real_as_float option, Real is a synonym for float instead of a double.

Real Real number
What's wrong with that?

Real Real number
What's wrong with that?



Mostly what I want to get is flaot,int, double these, I don't know what kind of real to belong to.

Because my requirement here is that the user writes a SQL to get the results, I need to use the type as the display.


Real Real number
What's wrong with that?



Mostly what I want to get is flaot,int, double these, I don't know what kind of real to belong to.

Because my requirement here is that the user writes a SQL to get the results, I need to use the type as the display.



Or does real belong to a number?

Real? Double

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.