I am running a php script and it is only displaying some rows, it seems to be random to which it displays. I have a sum function on the page and it adds up all the information correctly but will not show all the results. I have ran the scripts in phpmyadmin as well as MS Access and it displays all the data but when I run the script in my php document some of the data disappears. Below is my code.
[php]//Get PartID from URL
$iPartID = $_GET[“PartID”];
$oIteminfo = mysql_query("
SELECT Items.PartID, Items.VendorCost, Items.ProductName, Sum(Sales.AmountSold) AS SumOfAmountSold
FROM Items
LEFT JOIN Sales
ON Items.PartID = Sales.PartID
GROUP BY Items.PartID, Items.VendorCost, Items.ProductName
HAVING Items.PartID=$iPartID;
") or die(mysql_error());
while($row = mysql_fetch_array($oIteminfo))
{
ECHO "<br><table border=0 cellpadding=3>";
ECHO "<tr>";
ECHO "<td><img src=\"http://www.wowauctionsales.com/images/".$iPartID.".jpg\"height='35' width='35'></td>";
ECHO "<td><h1>".$row['ProductName']."</h1></td>";
ECHO "</table>";
ECHO "<B>Total Sold: </B>".$row['SumOfAmountSold']."<br>";
ECHO "<B>Vendor Price: </B>";
$number =$row['VendorCost'];
echo substr($number,-6,2).'g '.substr($number,-4,2).'s '.substr($number,-2,2).'c';
}
$oIteminfo = mysql_query("
SELECT Sales.PartID, Sales.AmountSold, Sales.PricePerItem, Buyers.BuyerName, Buyers.Server, Sales.Day, Sales.Month, Sales.Year, Buyers.BuyerID
FROM Buyers
LEFT JOIN Sales
ON Buyers.BuyerID = Sales.BuyerID
WHERE Sales.PartID=$iPartID;
") or die(mysql_error());
while($row = mysql_fetch_array($oIteminfo))
{
ECHO “
Amount Sold | ";Price Per | ";Buyer | ";Server | ";Day | ";Month | ";Year | ";
”.$row[‘AmountSold’]." | “;”.substr($number,-6,2).'g '.substr($number,-4,2).'s '.substr($number,-2,2).‘c’.” | ";<a href=“buyerinfo.php?BuyerID=”.$row[‘BuyerID’].”">".$row[‘BuyerName’]." | ";”.$row[‘Server’]." | “;”.$row[‘Day’].” | “;”.$row[‘Month’].” | “;”.$row[‘Year’].” | ";
}
?>
[/php]
Any Suggestions would be greatly appreciated, as I am not sure where to start. I can debug some things but this is beyond my knowledge.