I'm almost afraid to post this, as the top 20 questions that the auto search returns are all downvoted to oblivion. I have read through each of the questions that have already been asked, and my question seems to be different.
My query is working fine, in that, it is giving me the correct data as a response. However, I am still getting this error and I can't figure out why. Here's the code:
$acOneLowestCostQuery = "SELECT * FROM $acSupplierOne where quotePartNumber = '$acPartNumberOne' ORDER BY quoteCost ASC LIMIT 1" ;
$acOneLowestCost = mysqli_query($con, $acOneLowestCostQuery);
while ($row = mysqli_fetch_array($acOneLowestCost)) {
$acOnePartNumber = $row['quotePartNumber'];
$acOneLowestCost = $row['quoteCost'];
?>
My table outputs the correct information, but above the table is:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in ... on line 199
line 199 is
while ($row = mysqli_fetch_array($acOneLowestCost)) {
What I don't understand is that:
- I copied this entire code (and just changed the variable names) from another page where's it working perfectly, (without any errors)
- The code executes just fine AND returns the right data into my table
- I don't understand why it's telling me I'm passing it a string - unless it's because the result of the query only gives back a SINGLE line (from the
ASC LIMIT 1), and maybe you need two lines to make an array???
Would someone help me understand why this error is occurring? I'd rather fix the problem then use error reporting to not show it.
var_dump($acOneLowestCost);above the while?object(mysqli_result)#6 (5) { ["current_field"]=> int(0) ["field_count"]=> int(18) ["lengths"]=> NULL ["num_rows"]=> int(1) ["type"]=> int(0) }. I've looked into var_dump a bit, but this is way more complex than I'm used to reading... Can you help me interpret it?