»
S
I
D
E
B
A
R
«
Using ORDER BY with UPDATE
Jul 21st, 2009 by admin

Yep, you read the title correctly. This problem presented itself when I needed a quick and dirty way to update an auto_increment [a_i] field in a database. I wanted to move the a_i field up by n, where a_i > x. The query looked like this:

UPDATE table_name SET id = (id + n) WHERE id > x ORDER BY id DESC

To see why one must do it this way, try to do the query without the SORT BY.

Nick

Yet another example of the ‘perks’ of Socialism
Jul 14th, 2009 by admin

OK, fine, full-blown Socialism does not exist in the UK; however, the UK is definitely more socialized than here in the States.  Below, you will find a great ‘perk’ of trying to work with more-socialized countries:

Q: How come other services are not blocked?

We can only really speak for ourselves on this one. There are two rules we follow: to abide by standing copyright laws, and to pay artists fairly.

In the UK, to be a licensed service for all the music we want to play on Pandora, we are being asked to pay per track/stream rates which equate to over 80% of our gross revenues. This licensing framework does not enable any entity to grow an economically viable ad-supported Internet radio business. These rates apply to all Internet radio, or so we have been told. You would have to ask those other companies about how they are still streaming to the UK.

That is from www.pandora.com, one of [if not the] best free-streaming-radio websites available online.

Nick

mysqli_num_rows() functionality
Jul 13th, 2009 by admin

Warning: mysqli_num_rows() [function.mysqli-num-rows]: Function cannot be used with MYSQL_USE_RESULT

Does this error look familiar? Yeah, weird that even though you are using mysqli_, it says MYSQL_; trust me, I know. Instead of using mysqli_use_result(), try mysqli_store_result(). Problem sloved.

Nick

»  Substance: WordPress   »  Style: Ahren Ahimsa