开发者

Joing MYSQL row results (e.g Article info) with Multilple sub rows (e.g Comments) to one var in PHP

开发者 https://www.devze.com 2023-03-17 00:42 出处:网络
Tried searching, not sure if using right words. Ok so I want to pass every announcements paired with each announcements multiple comments to a template in 1 varia开发者_如何转开发ble (so I dont have

Tried searching, not sure if using right words.

Ok so I want to pass every announcements paired with each announcements multiple comments to a template in 1 varia开发者_如何转开发ble (so I dont have to put business logic there). Any ideas how to do this?

Heres what I have so far: http://pastebin.com/JvKXtB5a

Getting errors.


Regarding the error, you're making an array as an index to an array, you can't do that. What you're doing in something like:

$annoucementarray = array('value'); // assuming this is the value
$tmparray = array($annoucementarray => 'test'); // Warning: Illegal offset

You cannot use an array as an index, in your case you want $annoucementarray to be the index of a new array assigned to $tmparray.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号