I am currently trying to get a data(M\_Name) from a table called Merchant.

Following are my codes:

```
<?php
$response = array();

$link = mysql_connect('localhost','root','') or die ('Could not connect: '.mysql_error());
mysql_select_db('ichop') or die ('Could not connect to database');

$result = mysql_query("select * from offer") or die(mysql_error());

if(mysql_num_rows($result) > 0){
    $response["offers"] = array();

    while($row = mysql_fetch_array($result)){
        $offer = array();
        $offer["offer_id"] = $row["Offer_ID"];
        $offer["start_date"] = $row["Start_Date"];
        $offer["end_date"] = $row["End_Date"];
        $offer["o_desc"] = $row["O_Desc"];
        $offer["short_desc"] = $row["Short_Desc"];
        $offer["merchant_ID"] = $row["Merchant_ID"];
        $offer["m_name"] = mysql_query("SELECT M_Name FROM MERCHANT WHERE MERCHANT_ID = '".$row["merchant_ID"]."'");

        array_push($response["offers"], $offer);
    }
    $response["success"] = 1;

    echo json_encode($response);
} else {
//no offer found
$response["success"] = 0;
$response["message"] = "No offer found";

echo json_encode($response);
}
?>

```

When I run this PHP file using web browser, I couldn't get the desired name for the merchant even though the data is there in the database...it would just return me "null".

```
{"offers":[{"offer_id":"1","start_date":"2013-05-17","end_date":"2013-05-18","o_desc":"AAA","merchant_ID":"2","m_name":null}],"success":1}

```

What have I done wrong or what am I still missing? Please help..thanks!