I have used a mysql query to receive a variable and placed it in a link. The problem is when the variable contains two words it only displays the first in the link.
eg. if the variable contained the words 'tim tam' after the query this is what would happen
THE CODE
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
$query="SELECT recent_query, COUNT(*) as total from recent GROUP BY recent_query ORDER BY total DESC LIMIT 5";
$result=mysql_q uery($query);
$num=mysql_numr ows($result);
mysql_close();
echo "<table width=200 border=1><tr><t d><b>Most Searched</b></td></tr>";
$i=0;
while ($i < $num) {
$recent_query=m ysql_result($re sult,$i,"recent _query");
echo "<tr><td width=200><div style=padding-left:15px;><a href=/search/$recent_query target=_self>$r ecent_query</a></div></td>
</tr>";
THE RESULT
www.mydomain.co m/search/tim
if i can get the resulting link to say www.mydomain.co m/search/tim+tam things would work.
Any clues?
eg. if the variable contained the words 'tim tam' after the query this is what would happen
THE CODE
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
$query="SELECT recent_query, COUNT(*) as total from recent GROUP BY recent_query ORDER BY total DESC LIMIT 5";
$result=mysql_q uery($query);
$num=mysql_numr ows($result);
mysql_close();
echo "<table width=200 border=1><tr><t d><b>Most Searched</b></td></tr>";
$i=0;
while ($i < $num) {
$recent_query=m ysql_result($re sult,$i,"recent _query");
echo "<tr><td width=200><div style=padding-left:15px;><a href=/search/$recent_query target=_self>$r ecent_query</a></div></td>
</tr>";
THE RESULT
www.mydomain.co m/search/tim
if i can get the resulting link to say www.mydomain.co m/search/tim+tam things would work.
Any clues?
Comment