Okay first of all I am new and this is my first function. I borrowed most of the code but then tried to change it to suit my needs. The function is suppose to receive an id and then use it in the function to join two tables and then display the results in a table. I get the Table and the field names but can't get the results from the table. I added a line to print the id to assure the function was getting it and it was. I also ran the query through mysql directly and got the proper results. Thanks in advance:
function orderidToEditOrder($orderid){
//given a table name, generates HTML table including
//edit buttons
$orderid = filter_input(INPUT_POST, "orderid");
$orderid = mysql_real_escape_string($orderid);
global $dbConn;
$output = "";
$query = "select category.cat_name, orders.wgt_ounces, orders.del_date from orders, category where orders.id='$ordersid' and category.id=orders.cat_id";
$result = mysql_query($query, $dbConn);
$output .= "<table border = '1'>\n";
//get column headings
//get field names
$output .= "<tr>\n";
while ($field = mysql_fetch_field($result)){
$output .= " <th>$field->name</th>\n";
} // end while
//add empty columns for edit
$output .= "<th width=70></th>\n";
$output .= "</tr>\n\n";
//get row data as an associative array
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo "<tr>\n";
$output .= " <td>Item: {$row['category.cat_name']} </td>";
$output .= "<td>Weight in Ounces: {$row['orders.wgt_ounces']} </td>";
$output .= "<td>Delivery Date: {$row['orders.del_date']} </td></tr>";
}
$output .="</table>";
return $output;
} // end orderidToEditOrder