Jump to content

Search the Community

Showing results for tags 'error: query was empty'.

  • 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. Thank you for the help thus far everyone! I have updated my code with the help of reqinix. Now I have this error: Error: Query was empty Brief - I want the user to enter their eMail into the form and submit it to signup.php; the PHP file will do the following: Generate a random User_ID that is 16 characters long. Check the database to make sure the Unque_ID does not exist. If it does exists the script will generate another random User_ID and attempt again . If it does NOT exist the PHP script will continue. Check the database to make sure the eMail does not exists. If it does exists the fuction will not create a new account and displays "eMail already exists." If it does NOT exists then the script will continue. The PHP script will add the informtion to the table named "eMail" as a new entry. Here is the updated script with requinix's help: <?php $con = mysql_connect("localhost","******","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("diamon79_mysql", $con); function generateRandomString($Generate_ID = 16) { return substr(str_shuffle("01234567890123456789"), 0, $Generate_ID); } $searchquery = "SELECT * FROM eMail WHERE `User_ID` = '$Generate_ID'"; $searchresult = mysql_query($searchquery) or die(mysql_error()); if (mysql_num_rows($searchresult) == 0) { $User_Id = $Generate_ID; eMailCheck(); } // no rows found else { generateRandomString(); } function eMailCheck() { $eMail = "$_POST[eMail]"; return $eMail; } $searcheMailquery = "SELECT * FROM eMail WHERE `eMail` = '$eMail'"; $searcheMailresult = mysql_query($searcheMailquery) or die(mysql_error()); if (mysql_num_rows($searcheMailresult) == 0) { PostInformation(); } // no rows found else { echo "eMail already exists"; } function PostInformation() { $sql="INSERT INTO eMail (User_D, eMail) VALUES ('$User_ID','$_POST[eMail]')"; } if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?>
×
×
  • 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.