Jump to content

Search the Community

Showing results for tags 'php query function'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello all, This is my first post. Im trying to learn PHP from scratch. So for myself im making a registration system and some other things but there is something strange happening and i can not figure it out. I have a registration form that makes a email activation link. So now on activation.php im doing something like this <?phpif (isset($_GET['emailcode'])) { $emailcode = strip_tags(trim($_GET['emailcode'])); //Check if only numbers and letters if (!preg_match("/^[a-zA-Z0-9]+$/", $emailcode)){ echo $emailcode; $errors[] = 'code is not ok..'; } else { activateUser($emailcode); } } activateUser goes tot functions.php where i do this function activateUser($emailcode) { $sql = "SELECT * FROM users WHERE emailcode='$emailcode' LIMIT 1"; $query = mysqli_query($db_connect, $sql); $code_check = mysqli_num_rows($query); if ($code_check == 1) { echo 'exists'; } } the strange thing is, it returns nothing.. but when i attach te code on the activation page itself like this: <?phpif (isset($_GET['emailcode'])) { $emailcode = strip_tags(trim($_GET['emailcode'])); //Check if only numbers and letters if (!preg_match("/^[a-zA-Z0-9]+$/", $emailcode)){ echo $emailcode; $errors[] = 'De door jou opgegeven email code klopt niet'; } else { $sql = "SELECT * FROM users WHERE emailcode='$emailcode' LIMIT 1"; $query = mysqli_query($db_connect, $sql); //Tellen hoeveel rijen er gevonden zijn 0 of 1 $code_check = mysqli_num_rows($query); if ($code_check == 1) { echo 'exists'; } } } ?> it does work.... what am i doing wrong? on the activation page I have included de db connect and the functions...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.