Reputation: 3
I am able to add dashes to the url with the help from previous post but, I can not get the proper page to load once i complete this task.
A portion of the php code:
$query_getDisplay = sprintf("SELECT blog.title, blog.description, blog.keywords,
blog.blog_entry, DATE_FORMAT(blog.updated, '%%M %%e, %%Y') AS formatted,
blog.blogphoto FROM blog WHERE blog.category = 'videos'
AND DATE_FORMAT(blog.updated, '%%Y-%%m') = %s
ORDER BY blog.updated DESC", GetSQLValueString($var1_getDisplay2, "text"));
} elseif (isset($_GET['title'])) {
$var2_getDisplay3 = $_GET['title'];
$query_getDisplay = sprintf("SELECT blog.title,blog.description, blog.keywords,
blog.blog_entry, DATE_FORMAT(blog.updated, '%%M %%e, %%Y') AS formatted,
blog.blogphoto FROM blog WHERE blog.title = %s",
GetSQLValueString($var2_getDisplay3, "text"));
} else {
$query_getDisplay = "SELECT blog.title, blog.blog_entry, blog.description,
blog.keywords, DATE_FORMAT(blog.updated, '%M %e, %Y') AS formatted,
blog.blogphoto FROM blog WHERE blog.category = 'videos' ORDER BY blog.updated DESC
LIMIT 2";
}
$getDisplay = mysql_query($query_getDisplay, $check_mag) or die(mysql_error());
$row_getDisplay = mysql_fetch_assoc($getDisplay);
$totalRows_getDisplay = mysql_num_rows($getDisplay);
?>
URL works properly code shown below
<div id="recent">
<h3>Recent Post</h3>
<ul>
<?php do { ?>
<li><a href="videos.php?title=<?php echo str_replace(' ',
'-',$row_getRecent['title']); ?>"
><?php echo $row_getRecent['title']; ?></a></li>
<?php } while ($row_getRecent = mysql_fetch_assoc($getRecent)); ?>
<li> <a></a></li>
</ul>
</div>
Upvotes: 0
Views: 683
Reputation: 95161
Am not sure why you want to run str_replace
on URL
but i guess you want proper Url encoding .. you should try urlencode
http://php.net/manual/en/function.urlencode.php instead
urlencode($row_getRecent['title']);
Upvotes: 1