Hi all, hope some one can help me on this??

I need to create the following json data, my PHP code produces this no problems, but I cant seem to loop $back with respect to $images and $text to show all my records in the below json string, I now its due to the way my SQL statement setup, so I managed to get my sql to produce one record"-126555895" that seem to work fine, but try to remove the WHERE and the entire json structor collapses, and messy data comes up.

I think I need to join my sql by weID, I think thats where the problem is, any help in this is much appreciated.

                "weID": "-126555895",
                "size_h": "700",
                "size_w": "494",
                "images": [
                                "imgID": "1535689403",
                                "imgName": "1321865407"
                "text": [
                                "txtID": "-1892792786",
                                "txtText": "4.99"
                                "txtID": "1583276033",
                                "txtText": "$"

// I cant loop the above structure  to show more records from $back in the above json layout
PHP Code:
//my PHP code:
$back mysql_query("SELECT weID, size_h, size_w  FROM wb WHERE weID=-126555895");
$images mysql_query("SELECT imgID, imgName  FROM wi WHERE weID=-126555895");
$textmysql_query("SELECT  txtID, txtText FROM wt WHERE weID=-126555895");
//all my above SQL statements have weID in common, how can I link them together, to show all my results rather then one "-126555895"??
$model = array();
$e mysql_fetch_assoc($back)){
$model['weID'] = $e['weID'];
$model['size_h'] = $e['size_h'];
$model['size_w'] = $e['size_w'];
$h mysql_fetch_assoc($images)) {
$model['images'][] = array(
'imgID' => $h['imgID'],
'imgName' => $h['imgName']
$f mysql_fetch_assoc($text)){
$model['text'][] = array(
'txtID' => $f['txtID'],
'txtText' => $f['txtText']
json_encode ($model);