Jump to content

Returning URL with mysql record id after search


braden

Recommended Posts

I wanted to know how to post the mysql record "id" in the url (ie http://mysite.com/searchresult.php?id=326) after a search.  Is there a particular function that would let me echo that variable in the url after a search?  This way I can use "get" for navigation.

 

Regards,

Bradem

 

<?php
$id = $_GET['id'];
$sql = "SELECT * FROM `table` WHERE `id`='$id'";
$result = mysql_query($sql) OR DIE("$sql :: ".mysql_error());
if (mysql_num_rows($result) > 0)
{
while ($row = mysql_fetch_array($result))
{
	// do something
}
} else
{
// do something else
}
?>

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.