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 ? Link to comment https://forums.phpfreaks.com/topic/73939-solved-array-help/ 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. Link to comment https://forums.phpfreaks.com/topic/73939-solved-array-help/#findComment-373098 Share on other sites More sharing options...
GamingWarrior Posted October 19, 2007 Author Share Posted October 19, 2007 Thanks, and will read now. Link to comment https://forums.phpfreaks.com/topic/73939-solved-array-help/#findComment-373102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.