![]() |
Forum help
Heya, you might have seen my thread ..
Anyways, I'm just wondering if this is OKAY: php Code:
I want the thread_details array to be like this: Code:
thread_details[1] => array('thread_id' = 43, 'thread_posts' = 25, 'thread_views' = 656, 'thread_author' = 'Tanax') |
You don't need to manually iterate over the array, just use []
PHP Code:
|
But then every thread id and etc, will be on the same array..index or w.e it's called :S
I want to seperate them, so it's [1] => information about first thread that's found. Thread id, thread author etc.. [2] => information about second thread that's found.. [3] => -||- etc.. |
Quote:
PHP Code:
|
Quote:
$array[1] = array('thread_id' ..... ); $array[2] = array('thread_id' ..... ); $array[3] = .. etc |
Quote:
indexes? I thought you just need the values, not the indexes... Basically, the code you wrote is okay, but you don't need to keep an additional count of the array..it's useless...if you need, do something like: Code:
$this->threads_details = array( 0 => null ); // this should go into the constructor, perhaps |
Are you saying you want an individual array for each one? If so, I'm not really sure why?... Something like the following should be efficient enough:
PHP Code:
Code:
Array |
Quote:
|
@hostfreak- That's exactly what I want!
Because I'm fetching the threads in a specific forum, and I want all threads in the same array. If I fetch those threads, all threads will have different IDs, and that's why I want to seperate them with different arrays, but still in the same variable.. if that makes any sense. Because there will be multiple 'thread_id' keys if I put them in the same. And it'll be a total mess. That's why I want to seperate them :) But when I add them, should it be like: PHP Code:
PHP Code:
|
I understand why you want to do that. At first I thought you meant a completely different array for each one, my mistake. What I posted is known as a multidimensional array.
|
Quote:
PHP Code:
|
Tanax, try it? I don't see why you don't just go through a rigorous series of trial & error..
Try the mentioned methods or your methods, then use var_dump or print_r to see the output, decide for yourself if it's what you need. |
Because it's used within a function in a class, and it's not complete, so.. :P
|
| All times are GMT. The time now is 06:18 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0