GamingWarrior Posted October 19, 2007 Share Posted October 19, 2007 Ok i think i must be doing a stupid mistake. basically $number is and Array echo $number (prints "Array") print_r($number) (prints "Array ( [COUNT(theme_id)] => 4 )") but this is the part the i cant work out echo $number[COUNT(theme_id)] (prints nothing) why would it not print 4 ? Quote Link to comment Share on other sites More sharing options...
Orio Posted October 19, 2007 Share Posted October 19, 2007 You are confusing php- it is trying to use the count() function to calculate the key you want. So to solve this problem, use quotes: echo $number['COUNT(theme_id)']; Using single quotes around array keys is correct coding. Not using single quotes will generate a warning, that can only be seen if you increase the level of your error reporting. Orio. EDIT- I just wanted to add, you should check the "Array do's and don'ts" in the manual for more info. Quote Link to comment Share on other sites More sharing options...
GamingWarrior Posted October 19, 2007 Author Share Posted October 19, 2007 Thanks, and will read now. 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.