Help with SQL query?

Caporegime
Joined
12 Mar 2004
Posts
29,919
Location
England
Code:
while($bpo = mysqli_fetch_array($bpolist)) {
	$product = mysqli_fetch_array(mysqli_query($con, "SELECT productTypeID FROM invBlueprintTypes WHERE bluePrintTypeID =".$bpo['typeId']));
	$requirements = mysqli_query($con, "SELECT * FROM invTypeMaterials WHERE typeID =".$product['productTypeID']);
	while($materials = mysqli_fetch_array($requirements)) {
		$materialCost = mysqli_fetch_array(mysqli_query("SELECT jitaPrice FROM MINS WHERE typeId=".$materials['materialTypeID']));
		echo "Material cost: ".$materialCost['jitaPrice'];
		echo "<br/>";
		echo "Material cost added: ".$materialCost['jitaPrice'] * $materials['quantity'];
		echo "<br/>";
		echo "productID: ".$materials['typeID'];
		echo "<br/>";
		echo "materialTypeID: ".$materials['materialTypeID'];
		echo "<br/>";
		echo "quantity: ".$materials['quantity'];
		echo "<br/>";	
	}
}

This code completes but produces:

Code:
Material cost:
Material cost added: 0
productID: 582
materialTypeID: 34
quantity: 2706

As the output. I can't understand it because if I enter the query "SELECT jitaPrice FROM MINS WHERE typeId= 34" for example in phpMyAdmin it returns the correct result a decimal (10,2).
 
Back
Top Bottom