Jump to content

Search engine friendly url


tommr

Recommended Posts

Can anyone please help me with my code.

I would like to display the data from another column instead of the id in the url generated by the scirpt.

 

<?php
include('/home/arts/public_html/shows/includes/config.db.php');
if ($link){
$rpp = 10; // results per page
$adjacents = 4;
$page = intval($_GET["page"]);
if(!$page) $page = 1;

$reload = $_SERVER['PHP_SELF'];

$sql = "select * from craft_shows WHERE venue_state='MD' order by start_date ";
$result = mysql_query($sql) or die(mysql_error());

// count total number of appropriate listings:
$tcount = mysql_num_rows($result);
    $date = strftime("%b %d, %Y", strtotime($row['start_date']));

echo "<table class='table7' width='100%' cellpadding='5' cellspacing='1'>";
echo "<tr><td> </td><td>Date</td><td>City</td><td>Show Name</td><td>Attendance</td></tr>";
echo "<tr><td colspan='7'><hr></td></tr>";

// count number of pages:
$tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number
$date = strftime("%b %d, %Y", strtotime($row['start_date']));
$count = 0;
$i = ($page-1)*$rpp;
while(($count<$rpp) && ($i<$tcount)) {
	mysql_data_seek($result,$i);
	$row = mysql_fetch_array($result);

     $id = $row['id'];
	echo "<tr><td>";
    echo "<a href=\"/show_submits/show_detail.php?id=$id\">Details</a>";
	echo "</td><td>";
	echo strftime('%b %d, %Y', strtotime($row['start_date']));
	echo "</td><td>";
	echo $row['venue_city'];
	echo "</td><td>";
	echo $row['show_name'];
	echo "</td><td>";
	echo $row['num_visitors'];
	echo "</td></tr>";
	$i++;
	$count++;
}
echo "</table>";
echo "<br>";
// call pagination function:
include("pagination1.php");
echo paginate_one($reload, $page, $tpages, $adjacents);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/229826-search-engine-friendly-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.