
January 13th, 2013, 10:18 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Posts: 64
Time spent in forums: 11 h 36 m 11 sec
Reputation Power: 1
|
|
|
PHP-DB - Checking $_GET
There's probably some simple fundamental solution that I'm missing to solve my problem so please throw me a bone.
Let's say I have a dynamic url's setup to display user profiles based on a number that corresponds to a particular profile.
Example: domain.com/?userprofile=5
Now let's say 6 does not correspond to any userprofile. If you were to manually navigate to domain.com/?userprofile=6 the resulting page would be blank.
How would I go about checking to see if the sql query corresponding to 6 comes back empty, so that i can either send a redirect or error?
PHP Code:
$query = mysql_query("SELECT * FROM `users` WHERE `uploadID` = '$uploadID'");
Note: I have have tested numerous values in if statements, such as:
if(empty($query))
if($query === 0)
I have also checked to see if an array holding the query data was empty, which didn't work either.
|