Re: Error I dont understand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <1997.201.246.38.137.1181595064.squirrel@xxxxxxxxxxxxxxxxx>,
=?iso-8859-1?Q?Jos=E9_Miguel_Santib=E1=F1ez_A. ?= <jms@xxxxxxxxx> writes
>
>> I am getting an error on a line of code that I don't understand and I
>> am hoping that someone can explain it to me. I will include the error
>> and line of code that it is telling me is the problem.
>>
>> Weeks
>>
>> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
>> result resource.
>>
>> while($row = mysql_fetch_array($result)){
>> // Increment the total cost of all items
>> $totalCost += ($row["qty"] * $row["itemPrice"]);
>>
>>
>
>99%: Your query, has an SQL error...

I would disagree, but it depends on his error settings on the server.  I
would have expected it to stop before reaching this line if it were a
SQL error.

100% <G> It's an error on the line
$result=...

...which, teech, you haven't shown us.


also you have the code, 
>  // Increment the total cost of all items
>  $totalCost += ($row["qty"] * $row["itemPrice"]); 

why? you could at least SELECT (qty*itemPrice) as totalitemprice.

Or, you may even be able to (depending on the rest of the page)
SELECT sum(qty*itemPrice) as totalcost
and save yourself a lot of code (and processing time)!


-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux