kisazeky Posted April 1, 2009 Share Posted April 1, 2009 Hi there, I've recently implemented a profile system on my site that, when given a valid username, will get his/her information from the user table and display it. But, how can I make it return a page "User not found!" if, well, the user can't be found. Thanks. My query looks like this: $query = "SELECT * FROM owned_adoptables WHERE owner = '$owner' ORDER BY uid DESC LIMIT 0,5 "; $result = mysql_query($query); $num = mysql_numrows($result); //Loop out code $i=0; while ($i < $num) { $id=@mysql_result($result,$i,"uid"); $name=@mysql_result($result,$i,"name"); $imageurl=@mysql_result($result,$i,"imageurl"); Quote Link to comment https://forums.phpfreaks.com/topic/152007-how-to-return-a-page-when-data-is-not-found-in-a-table/ Share on other sites More sharing options...
Maq Posted April 1, 2009 Share Posted April 1, 2009 if$num == 0) { header('Location: ../not_found.php'); } else { //code to proceed } Quote Link to comment https://forums.phpfreaks.com/topic/152007-how-to-return-a-page-when-data-is-not-found-in-a-table/#findComment-798296 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.