Jump to content

Where is the ' coming from?


3raser

Recommended Posts

My error: 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key FROM applications WHERE key = '0188f'' at line 1

 

Code:

 

		function randomNum()
		{
			$random = substr(md5(rand(5000,300000)), -5);
			$query = mysql_query("SELECT key FROM applications WHERE key = $random") or die(mysql_error());

			//make sure it doesn't already exist
			if(mysql_num_rows($query) > 0)
			{
				randomNum();
			}
			else
			{
				return $random;
			}
		}

 

I simply cannot seem to figure out what is happening...I've tried many solutions, but all seem to fail.

Link to comment
https://forums.phpfreaks.com/topic/246940-where-is-the-coming-from/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.