Wow! Thanks a lot.
Upgrading to 1.3 isn't very simple! But new project do use cakePHP
v1.3
On May 18, 9:24 pm, Jamie wrote:
> Talk about going off on a tangent! :) Let's get to the core of the
> issue, which is just array_rand()...
>
> HK, what version of Cake are you using? If you're using 1.2,
wow, the CahePHP core can impact on some PHP functions ... my bad!
@piousbox: I've seen a lot of threads which clearly state you should
rarely use MySQL's RAND() due to serious performance issues. If you
rely on this a lot it may be worth you doing Googling to decide if you
should refactor some o
Talk about going off on a tangent! :) Let's get to the core of the
issue, which is just array_rand()...
HK, what version of Cake are you using? If you're using 1.2, check out
this ticket:
http://cakephp.lighthouseapp.com/projects/42648/tickets/73-securitycipher-should-only-call-srand-in-php4
Bas
I don't want rand to be employed on the sql. The concept is to cache
some records (so as not to hit to database all the time) and then get
a random record.
Just for the record :
in the above code I had srand(floor(time() / (60*60*24)));
debug(rand()); which always returned the same value.
When I c
First, if you're developing this application, I strongly advice not
messing with caching until you're ready to deploy. In particular, you
do $banners_tmp = Cache::read('banners'); even if it returns empty?
Maybe you're looking at only your cached version all the time, not
what's in your database?
Well it is like:
$a => [0] => ['Action'] => ['text']
=> ['banner']
=>['Category'] => ['description']
[1] => ['Action'] => ['text']
=> ['banner']
=>['Category'] => ['description']
.
Even if
srand() and rand() are not functions from the Cake core, they are PHP
functions and as such operate as the PHP manual says they do.
There must be some other factor that is causing your issue, maybe
something to do with the way the array your trying to randomise is
structured?
HTH
Paul.
Check ou
Hello,
I have a strange problem with one of my applications.
Consider the following code:
function getBanner() {
$banners_tmp = Cache::read('banners');
if(empty($banners_tmp))
{
$this->loadModel('Position');