SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Estonia
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    matching variables with mysql column types

    I am trying to write a small but intelligent piece of code
    that would take the table and column properties and before inserting new
    values into a table and compare them to the columns and their types.
    I have the data posted from a form and I also have the types of columns in arrays. My question is: is there another possibility to do this besides
    taking each possible column type and writing an "if" clause for it?
    Is there a simpler way around this?
    (Is there a way to check for example if a number is an integer or a float within a certain range or precision, fits into a certain number of decimals etc. )
    Thanks!



    vahur
    Last edited by vahur; Sep 30, 2004 at 15:03. Reason: typo

  2. #2
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Treat them all as strings and use regular expressions to test the numbers.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •