spaces in query string driving me nuts
Posted: Thu Oct 16, 2003 3:51 pm
ok -- I am pulling names in from a text file, and searching the database for them --
here is my query (you probably saw this earlier
)
$query="SELECT * FROM user WHERE username='$uid'";
print "query: $query <br>";
print "uid: $uid<br>";
$id = mysql_query($query,$db);
$user=mysql_fetch_array($id);
print $user[username];
I'm not getting any results -- if I sub a real name for the variable $uid, it works fine --- so I put all those print statments in there -- and it looks like there are spaces at the ends of the names I am pulling from the txt file.
is there a way to ignore them, or anyone got a good function to pull them off ??
Thanks again!!
here is my query (you probably saw this earlier
$query="SELECT * FROM user WHERE username='$uid'";
print "query: $query <br>";
print "uid: $uid<br>";
$id = mysql_query($query,$db);
$user=mysql_fetch_array($id);
print $user[username];
I'm not getting any results -- if I sub a real name for the variable $uid, it works fine --- so I put all those print statments in there -- and it looks like there are spaces at the ends of the names I am pulling from the txt file.
is there a way to ignore them, or anyone got a good function to pull them off ??
Thanks again!!