Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7408517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:55:53+00:00 2026-05-29T05:55:53+00:00

So I am using the following functions to grab the datatype of certain fields

  • 0

So I am using the following functions to grab the datatype of certain fields in an SQL database.

$type  = mysql_field_type($result, $i);
$len   = mysql_field_len($result, $i);

I need to use these datatypes to ultimately structure another table. The problem is the returns I am getting from these functions are not valid SQL datatypes, I am getting returns like this: string (25), int (11), string (25)

Int is ok but string is not an SQL datatype, so do I need to figure out which returns need to be reformatted into correct datatypes and make functions to do that? Or am I missing another way to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:55:53+00:00Added an answer on May 29, 2026 at 5:55 am

    you will see that the mysql_field_type() function will return the following data as per (http://it2.php.net/mysql_field_type):

    CHAR, VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT, ENUM, SET: string
    TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT: int
    FLOAT, DOUBLE, DECIMAL, NUMERIC: real
    TIMESTAMP: timestamp
    YEAR: year
    DATE: date
    TIME: time
    DATETIME: datetime
    TINYBLOB, MEDIUMBLOB, LONGBLOB, BLOB: blob
    

    Perhaps you can rather try something like:

    $table = "my_table";
    $result = mysql_query("DESCRIBE TABLE `{$tabler}`");
    while ($row = mysql_fetch_object($result)) {
        $field = $row->Field;
        $type = $row->Type;
    }
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following query to grab delivery types from an SQL database,
I'm using the following functions: # The epoch used in the datetime API. EPOCH
I am using the following functions for writing and reading 4098 floating point numbers
I'm using PostgreSQL 9.1.3 and the following functions: CREATE OR REPLACE FUNCTION cad(INOUT args
Using PHP's Image and GD functions you can use the following method to finally
I'm using the following code to grab a wmv file through a WebResponse. I'm
I'm using the following loop to grab files for an animation. This method makes
I am using the following functions: function loop_perms(permissions) { .... call check_perm here.... }
I'm using the following to grab some updated HTML and insert it into a
I am using following code to grab data from JSON. $(document).ready(function() { $.getJSON(http://www.example.com/data.php?id=113&out=json, function(data)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.