Jump to content


Photo

need help with sql query...


  • Please log in to reply
1 reply to this topic

#1 gtridez

gtridez
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 30 August 2006 - 06:16 AM

hey...

i'm tryin to query something in a mysql table ...
i'm searchin a table to find a username where the user name is "Myuser" ...ie the first letter is upper case
It only returns a result if i type "Myuser" in the form and not "myuser" ...
the colation of the field is latin1_swedish_ci

the code is as below...
any help will be greatly appreciated...thanx

include("includes/connect_gtriderz.php");
			$sql = "SELECT * FROM members WHERE username='$username'";
			$query = mysql_query($sql);
			
			while ($row = mysql_fetch_array($query)) {
			$dbUser = $row['username'];
			
			if($dbUser == $username) {
				$errmsg = "We're sorry but the username <b><i>$username</i></b> already exists, please use another one ...";
				$error = "yes";
				$username = '';
				}
			}
			include("includes/closeDb.php");


#2 gtridez

gtridez
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 30 August 2006 - 07:09 AM

hey never mind guys ...i figured it out...

i stripped both of the values to lowercase using strtolower before comparing them...
$value1 = strtolower($originaltext);
$value2 = strtolower($dbtext);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users