Maq Posted April 6, 2009 Share Posted April 6, 2009 Change this line to: $result = mysql_query ("SELECT title, subtitle, article FROM articles WHERE id = '$currentpage'"); Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802459 Share on other sites More sharing options...
Gem Posted April 6, 2009 Author Share Posted April 6, 2009 We're getting somewhere now ... I changed $result = mysql_query ('SELECT title, subtitle, article FROM articles WHERE id = "' . $id . '"'); to this: $result = mysql_query ('SELECT title, subtitle, article FROM articles WHERE id = "' . $currentpage . '"'); and now I get this: Notice: Undefined offset: 3 in d:\webspace\bradleystokejudoclub.co.uk\wwwroot\test1.php on line 10 BUT ... it is also displaying the subtitle and the article ... just not the title, and its not taking any notice of the nl2br for the article ... Getting there though ... anyone know what that error means? Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802468 Share on other sites More sharing options...
Gem Posted April 6, 2009 Author Share Posted April 6, 2009 Sorry Maq ... i didnt see your post before I posted again, I changed it to what you said, and it's the same ... Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802471 Share on other sites More sharing options...
premiso Posted April 6, 2009 Share Posted April 6, 2009 Your quotes on this line are backwards. This is not your notice issue, but will cause a SQL issue: $result = mysql_query ("SELECT id, title, subtitle, article FROM articles WHERE id = '" . $currentpage . "'"); Is the correct way, as in SQL you must use single quotes (') around string variables. Not double quotes. You needed the "id" column for it to work right. You were not pulling that out, thus your list was causing an issue trying to populate "$article" Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802474 Share on other sites More sharing options...
Gem Posted April 6, 2009 Author Share Posted April 6, 2009 You beauties!!! all works properly now!! Love u all loads x Gem x Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802477 Share on other sites More sharing options...
Maq Posted April 6, 2009 Share Posted April 6, 2009 Thx premiso @gemmerz, I had the quotes correct in my post, you don't have to break out of the string for variables to interpolate, with double quotes. Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802482 Share on other sites More sharing options...
Gem Posted April 6, 2009 Author Share Posted April 6, 2009 yeh i noticed after Maq ... sorry! Quote Link to comment https://forums.phpfreaks.com/topic/152674-solved-_getcurrentpage-i-think/page/2/#findComment-802492 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.