lssjg Posted May 13, 2006 Share Posted May 13, 2006 Hey,i'm currently creating a site... and i have nearly finished the member system... so i am now doing the news syetem. Only problem, i can't get the news out.In the mysql table...[code]CREATE TABLE `news` (`newsid` int( 25 ) NOT NULL AUTO_INCREMENT ,`author` varchar( 25 ) NOT NULL default '',`topic` text NOT NULL ,`news` text NOT NULL ,`date` datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY ( `newsid` )) ENGINE = MYISAM DEFAULT CHARSET = latin1 COMMENT = 'News System';[/code]it's something like that...then in the actual news page[code]<?include 'include/config.php';$query = mysql_query('SELECT * FROM news');while($news = mysql_fetch_array($query)) { echo "Title: $news['topic'] <br /> Author: $news['author'] <br /> Date: $news['date'] <br /> $news['news']"; }?>[/code]I am getting the following errorParse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\Websites\Server\www\site\site\news.php on line 8Obviously this is not going to be the actual thing... but before i format it... i want to get the coding done.Can someone please tell me what is wrong...P.S. the mysql stuff works... i checked in phpmyadmin and i even added a test row through phpmyadmin.But i still get the above error.[code] echo "Title: $news['topic'] <br />[/code] is line 8and when i divided the line in 2 [code]$news['topic'] <br />[/code] this part ended up being the problem partIf anyone could help me.... sometime soon... it would be extremely helpfull........Until then i'm kinda stuck Quote Link to comment Share on other sites More sharing options...
toplay Posted May 13, 2006 Share Posted May 13, 2006 Do this:echo "Title: {$news['topic']} <br />Author: {$news['author']} <br />Date: {$news['date']} <br />{$news['news']}"; Quote Link to comment Share on other sites More sharing options...
lssjg Posted May 13, 2006 Author Share Posted May 13, 2006 Ok... doing that.....and it works on both FF and IE.... thanks so much....it works..... thank-you so very much.... veyr happy [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] thanks,cya Quote Link to comment 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.