Help me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wugang_bob
Forum Newbie
Posts: 6
Joined: Thu Jun 26, 2003 8:20 pm

Help me

Post by wugang_bob »

Code: Select all

<?php
$query = "select * from userid where username='" .$_REQUEST['username'] ."'"; 
 $result=mysql_db_query($query);
   if(mysql_num_rows($result)==1)
	{
	  header("Location: fail3.php"); 
	 exit;
	}
?>
else ........
Execute the above code, no error message, but it seem does not work.

Thank you

Admin Edit note: Use the PHP BBCode tags. please.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Be sure to add an "or die()" to your mysql_db_query function.

Code: Select all

$query = "select * from userid where username='" .$_REQUEST['username'] ."'"; 
$result=mysql_db_query($query) or die("<B>Unable to exicute code from the query:</B><BR>\n" . $query . "<P><B>MySQL Error given:</B><BR>\n" . mysql_error()); 
if(mysql_num_rows($result)==1) 
{ 
header("Location: fail3.php"); 
exit; 
}
Give that a try, and post back the results you get, please. :)
Image Image
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

What's your Query look like at runtime (echo $query;), and are there any mysql errors? (echo mysql_error(); after mysql_query()).
wugang_bob
Forum Newbie
Posts: 6
Joined: Thu Jun 26, 2003 8:20 pm

Thank you for your help

Post by wugang_bob »

Now, It's work

Thank you :D
Post Reply