Hi...
I'm working on a page where I need to have a query built that draws a user's name from the database, and populates that name on a webpage as a link to another page (showing that user's information... also drawn from the database).
However, I've run into an issue with spaces in the name. The link info in the status bar when hovering over the link only shows the first name.
The code I'm using is as follows:
// Connection to Database //
$connection = mysql_connect('localhost', $db_user, $db_pass) or die(mysql_error());
mysql_select_db($db, $connection) or die(mysql_error());
// Set up the query //
$query = "SELECT driver FROM $db_table";
// Run query and get affected rows //
$result = mysql_query($query, $connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$driver = $row['driver'];
$ahref = "<a href=driverpage.php?driver=$driver>$driver</a>";
For example, if I'm wanting "John Smith" 's data, then I select his link on the page this code is running. What happens is when I click on the link it goes to a dead page... when when I hover over it, I get (in the status bar) "http://www.webpage.com/userpage.htm?john" instead of what I need to get, which would be "http://www.webpage.com/userpage.htm?john smith".
I'm not sure how to deal with this... is there a way to get around this? Or do I have to force users to run their names together without spaces, or just create a username with no spaces (which I'd really like to not have to do).
Thanks...