string replace of variable in database
I have a fields in my database that have spaces in them like "New York"
I want them to be able to be called by
states.php?id=newyork // with no space
Here is what I have so far...it's not working at all though:
<?php
$name4 = str_replace(" ","", $_REQUEST['id']);
$query='SELECT * FROM states WHERE
state="'.$name4.'"';
$result= mysql_query($query);
$myrow=@mysql_fetch_array($result);
if($myrow)
{
$state=$myrow['state'];
}
?>
I thank you all in advance for any help I can get..this forum is great
|