Jump to content


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


need help with sql query...

Recommended Posts


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

$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 = '';

Share this post

Link to post
Share on other sites
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);

Share this post

Link to post
Share on other sites


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.