Jump to content

Adding a field/variable to URL


erme

Recommended Posts

Hi,

 

I currently have something like this:

 

$extrapart = (isset($_GET['id'][0]))?"WHERE ID='".mysql_real_escape_string($_GET['id'])."'":"";
$_SESSION['extra'] = $extrapart;

$pageheader = mysql_query("SELECT DISTINCT ID FROM TableName $extrapart");

 

not written by me which is why im so confused.

 

I currently go to this which works fine:

 

http://site.co.uk/page.php?id=dev002

 

which pulls ID from the db. But I want to be able to include the county (which is in the db) that is associated with that ID like this:

 

http://site.co.uk/page.php?county=devon&id=dev002

 

Hope someone can make sense of what I'm trying to explain!

 

Thanks to all that help!

Link to comment
https://forums.phpfreaks.com/topic/190258-adding-a-fieldvariable-to-url/
Share on other sites

Would I be right in saying I need to do something like this:

 

$extrapart = (isset($_GET['id'][0]))?"WHERE ID='".mysql_real_escape_string($_GET['id'])."'":"";

$extrapart2 = (isset($_GET['county'][0]))?"WHERE County='".mysql_real_escape_string($_GET['county'])."'":"";

$_SESSION['extra'] = $extrapart $extrapart2;

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.