ted_chou12 Posted December 23, 2006 Share Posted December 23, 2006 $number = $data[$news][3];echo $number;will give you 2and then I wish to plug the two in:echo file_get_contents("newscomments/comments[[color=red]2[/color]].txt");so I do this:echo file_get_contents("newscomments/comments[$number]txt");but it doesnt work, the two doesnt show up for some reason..can anyone help me, thanksTed. Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 The 2 doesn't show, or the file opening fails?You're missing a . in the second line. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 23, 2006 Author Share Posted December 23, 2006 the 2 doesnt show, so instead of "newscomments/comments[2].txt" it opens "newscomments/comments[].txt"... Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 23, 2006 Author Share Posted December 23, 2006 what do you mean by a . , how do I add it in? Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 Look at what you wrote. The first one says .txt, the second says txt. Since you error does not reflect this typo, that means you didn't actually copy and paste your real code. Your mistake is probably there.Link? Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 23, 2006 Author Share Posted December 23, 2006 I found out why, sorry... I accidentally have a space after the number... ;DTed Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 24, 2006 Share Posted December 24, 2006 This is why you should actually post YOUR code, instead of retyping it. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 24, 2006 Author Share Posted December 24, 2006 ;DTed 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.