Welcome Guest, Not a member yet? Register   Sign In
need to retrieve records based on a value from another query
#2

[eluser]Victor Michnowicz[/eluser]
I don't know exactly what you are trying to do. But this info may help you out a bit. I would suggest creating your arrays with array keys matching your entry IDs:

[3]
['author'] => 'bob',
['title'] => 'my comment'
[12]
['author'] => 'tom',
['title'] => 'my other comment'
[22]
['author'] => 'sue',
['title'] => 'a comment'

instead of:

[0]
['id'] => 3,
['author'] => 'bob',
['title'] => 'my comment'
[1]
['id'] => 12,
['author'] => 'tom',
['title'] => 'my other comment'
[2]
['id'] => 22,
['author'] => 'sue',
['title'] => 'a comment'

This allows you to add in your steps kinda like this

Code:
foreach ($steps as $step)
{
    $comments[$step['comment_id']['steps'][] = $step['step_id'];
}

And you could get around having to use DISTINCT like so:

Code:
foreach ($steps as $step)
{
    $comments[$step['comment_id']['steps'][$step['step_id']] = $step['step_id'];
}

So now your array will look like this:

[3]
['author'] => 'bob',
['title'] => 'my comment',
['steps']
[0] => 4,
[1] => 5,
[2] => 19
[12]
['author'] => 'tom',
['title'] => 'my other comment',
['steps']
[0] => 23,
[22]
['author'] => 'sue',
['title'] => 'a comment',
['steps']
[0] => 2,
[1] => 65,


Messages In This Thread
need to retrieve records based on a value from another query - by El Forum - 01-05-2011, 03:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB