I have the following code and it appears on the screen at the beginning of the table: Query Was Empty
$userId=$_SESSION['u_id'];
$resultMyVouchers="SELECT oc.order_id, oc.order_amount, oc.coupon_id, oc.products_id, oc.purchased_by, oc.order_transaction_id, oc.options_id, oc.order_price, p.city_id, p.product_name, p.deal_status, p.product_closing_date, p.side_deal FROM orders oc LEFT JOIN products p ON oc.products_id=p.product_id WHERE oc.uid='".$userId."' AND oc.order_types='me' AND oc.order_transaction_id IS NOT NULL ORDER BY oc.order_id DESC";
$rsMyVouchers=dbQuery($resultMyVouchers);
echo '<div>';
echo '<table class="table table-striped table-bordered">';
echo '<thead>';
echo "<tr>";
echo "<th><strong>Cupon</strong></th>";
echo "<th><strong>Fecha de Compra</strong></th>";
echo "<th><strong>Monto</strong></th>";
echo "<th><strong>Estatus</strong></th>";
echo "<th><strong>Respuesta</strong></th>";
echo "</tr>";
echo '</thead>';
if(mysql_num_rows($rsMyVouchers)){
while($row=dbFetchArray($rsMyVouchers)){
$srtCoupon="SELECT * FROM coupons WHERE coupon_id='".$row['coupon_id']."' AND coupon_status='available' AND coupon_used='no'";
$responseCoupon=dbQuery($strCoupon);
$rsCoupon=dbFetchArray($responseCoupon);
echo "<tr>";
echo "<td>".$row['product_name']."</td>";
echo "<td>".date("Y / M / d H:i", dateTimeStamp($rsCoupon['coupon_purchase_date']))."</td>";
echo "<td>".$row['order_price']."</td>";
echo "<td>".$row['deal_status']."</td>";
echo "<td>"."</td>";
echo "</tr>";
}
}else{
echo "no Recibo datos";
}
echo "</table>";
echo '</div>';
Testing I discovered that the line that makes error is a query inside the While:
$srtCoupon="SELECT * FROM coupons WHERE coupon_id='".$row['coupon_id']."' AND coupon_status='available' AND coupon_used='no'";
$responseCoupon=dbQuery($strCoupon);
$rsCoupon=dbFetchArray($responseCoupon);
When I delete this query the data is displayed but obviously not the data I need from the Additional query. The general idea is to show the date of purchase of the coupon that is stored in another table and that is why I try to execute the query inside the while to obtain the date of each result found.