|
Posted by J.O. Aho on 10/01/39 11:29
charliefortune wrote:
> That's it, thank you. My price field is a float, and tracking_url is
> varchar. Is this why one works without quotes and the other needs them
> ?
Yes, varchar requires quotes or else it won't know what is part of the varchar
or what is the rest of the query.
> Also, is it more efficient to do several updates in a single query, I
> would assume so ?
It depends on how your query looks like, if you use just one statement when
you update, then it don't matter how much you update, but the exception is
when you feed the sql server with many statements at the same time, eg:
$query = "UPDATE product SET price=$newprice1, tracking_url='$newtracker1'
WHERE ASIN=$product_asin1; UPDATE product SET price=$newprice2,
tracking_url='$newtracker2' WHERE ASIN = $product_asin2";
This will make it really difficult to know what did cause a fault if you get
an error message. The slight speedup you get from the multi statement query is
to small to overweight the impossibility to track the errors, that it's a lot
better to make multiple queries which you can easily error check and handle.
The only time to make those multi statement queries would be if the sql server
runs on another machine and the connection is really bad between them (a lot
of package losses), but in that scenario, it would be a lot better to find
another server to have the sql on.
//Aho
[Back to original message]
|