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; ?> 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; 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. 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"; 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
Archived
This topic is now archived and is closed to further replies.