Use Multidimensional Array Value in Where Clause using Table Column Value as Ke

I cannot use the value of a multidimensional array in my where clause using a table column value as the key.

DB->query(" SELECT ID AS Key, LastPostID FROM table WHERE {$Array[Key]['PostID']} < LastPostID ");

If I change the “Key” to a number then the query works but for some reason I cannot use the table column “ID” value as the key. Is this possible?

What is the print_r value for the $Array variable?

Here is a small section

[php]Array ( [1] => Array ( [0] => 1 [TopicID] => 1 [1] => 1 [PostID] => 1 ) [3] => Array ( [0] => 3 [TopicID] => 3 [1] => 45 [PostID] => 45 ) [4] => Array ( [0] => 4 [TopicID] => 4 [1] => 204 [PostID] => 204 ) [5] => Array ( [0] => 5 [TopicID] => 5 [1] => 332 [PostID] => 332 ) ) [/php]

I am a bit tired but, the reason it won’t work is you array is effectively this:

[php] $Array[1] [‘TopicID’] [‘PostID’];[/php]

How are you filling the array, it may be simpler that your current approach.

Thanks.

The array is getting filled using a query. I’m looking into doing this differently and changing this query.

Sponsor our Newsletter | Privacy Policy | Terms of Service