Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    27
    Member #
    11781
    Is there a simple PHP function that checks whether a particular piece of data, e.g. a string or integer, matches a MySQL field type, e.g. TINYINT, etc.? Something along the lines of...

    $a = "my_string";

    $result = check_mysql_type($a,"TINYINT"); //returns false;

    $b = 56;

    $result = check_mysql_type($b,"TINYINT"); //returns true

    etc.

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You can check if a number is numeric (is_numeric), is a string, etc. Unfortunately, I don't know of a way of checking if it conforms to a MySQL column type, sorry.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    Jan 2006
    Posts
    3
    Member #
    12239
    what would be the purpose, maybe we can help you more if we know what your trying todo in the big picture.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:01 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com