Forum Moderators: coopster

Message Too Old, No Replies

probably stupid question php and CMS

probably stupid question php and CMS

         

tzviak1

4:38 am on Apr 8, 2010 (gmt 0)

10+ Year Member



Im trying to start a cms.
the url when you click on is:
index.php?

I need to get that page data and present it on the page
i already have everything set - it seems like the url data is not getting the page info therfore doesnt display it.
What am i doing wrong?

The link url is: index1.php?name=Dest&id=427

the code in that index1.php page that suppose to get the page id is:

$ulr = end(explode('/',$_SERVER['REQUEST_URI']));


if(!empty($ulr) AND empty($catid)){
//$thread = $db->query("SELECT * FROM ".DBPREFIX."pages WHERE i_pretty_url = '$ulr' ");
$thread = $db->query("SELECT * FROM ".DBPREFIX."pages WHERE i_id = '$ulr' ");

//if index , let variable by defaut
$wsettings['wbase_title'] .= " - ".$thread['i_name'];
$wsettings['wbase_description'] = utf_substr(strip_tags($thread['i_content']), 0, 130);
$wsettings['wbase_keywords'] .= str_replace(" ",",",$thread['i_name']);

}
else{
$thread = $db->fusion("SELECT * FROM ".DBPREFIX."pages WHERE i_isindex = '1' AND i_catid = '$catid' ORDER BY i_id DESC LIMIT 1 ");
}

Thank you all in advance.

Matthew1980

8:05 am on Apr 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there tzviak1,

Welcome to the forum :)

As you are passing vars from the URL using the query string operator (?), the easiest method would be to use the $_GET array, from there you can grab the data and use it as you want, but you need to check that it is indeed set before you can use it ;-p

if (isset($_GET['your_var']) && ($_GET['your_var'] == "your_value")){
//process data as it is set
}else{
//Oh dear not set, no information to display
}

And as you are using the URL data in a sql query, you will need to sanitise the data using something like mysql_real_escape_string(); Check out [uk.php.net ] for more info with regards to that.

Hope this helps a little,

Cheers,
MRb