Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Missing PHP Functions?

    I'm fairly new to PHP.

    I'm trying to validate PHP variables before updating a MySQL table. Mainly to establish decimal pointys, currency, etc. I've checked on the w3schools.com site and found the following refernce to using the built-in PHP filter functions. Except, when I run them, I get an error message - "Call to undefined function filter_var() in.....". It seems that I can't get any of the preloaded functions to work but any custom functions that I write do. Is there something wrong with my code or is there something wrong with my ISP's PHP installation?

    Following is the code that is placed in the body of my test page:

    Code:
    <?php
    $int = 123;
    if(!filter_var($int, FILTER_VALIDATE_INT))
     {
     echo("Integer is not valid");
     }
    else
     {
     echo("Integer is valid");
     }
    ?>

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    What version of php is installed?

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My PHPinfo shows it as Version 5.1.4

  • #4
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    It's not available until version 5.2.0

    http://us.php.net/manual/en/function.filter-var.php
    Last edited by PappaJohn; 06-09-2007 at 09:17 PM. Reason: added link

  • #5
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess that explains that then. Thanks.


  •  

    Posting Permissions

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