Though I have defined custname,Date and itemnum as array, while running the code i am getting error where ever i have used the above variables.
The error is given at the end
CODE
<?php
$con = mysqli_connect("localhost", "root", "","demo");
$custname=array();
$Date=array();
$itemnum=array();
$sql= "SELECT customermst.custid, customermst.custname, purchasemst.purchasedt, purchasemst.itemnum FROM customermst, purchasemst WHERE purchasemst.custid = customermst.custid ORDER BY custid";
echo $sql;
$result=mysqli_query($con,$sql);
while($row=mysqli_fetch_array( $result ,MYSQLI_BOTH))
{
$custname[]=$row["customermst.custname"];
$Date[]=$row["purchasemst.purchasedt"];
$itemnum[]=$row["purchasemst.itemnum"];
}
echo '<html><head><title>Reports</title></head><body>
<table>
<tr>
<td>Customer Name</td><td>Date</td><td>Item Number</td>
</tr>';
for($i=0; $i<=count($custname); $i++)
{
echo '<tr><td>'.$custname[$i].'</td><td>'.$Date[$i].'</td> <td>'.$itemnum[$i].'</td></tr>';
}
echo '</table></body></html>';
?>
ERROR
( ! ) Notice: Undefined index: customermst.custname in C:\wamp64\www\wordpress\project1\mastdtl.php on line 11
Call Stack
# Time Memory Function Location
1 0.0013 238792 {main}( ) ...\mastdtl.php:0
( ! ) Notice: Undefined index: purchasemst.purchasedt in C:\wamp64\www\wordpress\project1\mastdtl.php on line 12
Call Stack
# Time Memory Function Location
1 0.0013 238792 {main}( ) ...\mastdtl.php:0
( ! ) Notice: Undefined index: purchasemst.itemnum in C:\wamp64\www\wordpress\project1\mastdtl.php on line 13
Call Stack
# Time Memory Function Location
1 0.0013 238792 {main}( ) ...\mastdtl.php:0