y2yang Posted May 3, 2009 Share Posted May 3, 2009 Can anyone tell me what is wrong with this? Can I do this? $page_id = $news $cid; <?php if(!isset($_GET['Pid'])) { $cid = 1; } else { $cid = (int) $_GET['Pid']; } $news = "news_"; $page_id = $news $cid; ?> Quote Link to comment https://forums.phpfreaks.com/topic/156658-solved-page_id-news-cid-possible/ Share on other sites More sharing options...
the182guy Posted May 3, 2009 Share Posted May 3, 2009 You need to use the period symbol when concatenating variables like that. Try this: $page_id = $news . $cid; Quote Link to comment https://forums.phpfreaks.com/topic/156658-solved-page_id-news-cid-possible/#findComment-824888 Share on other sites More sharing options...
Daniel0 Posted May 3, 2009 Share Posted May 3, 2009 Though you might of course just want to do $page_id = 'news_' . $cid; unless you're going to use $news for something else. Quote Link to comment https://forums.phpfreaks.com/topic/156658-solved-page_id-news-cid-possible/#findComment-824910 Share on other sites More sharing options...
gevans Posted May 3, 2009 Share Posted May 3, 2009 Or go crazy and do this; $page_id = "news_$cid"; Quote Link to comment https://forums.phpfreaks.com/topic/156658-solved-page_id-news-cid-possible/#findComment-824944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.