[PHP] Problem with date

2009-09-15 Thread Korgan
Hi, I have a problem with date function. $gen_pos = mktime(0,0,1,10,25,2009); $d1 = date(Y-m-d, $gen_pos); // 2009-10-25 $d2 = date(Y-m-d, $gen_pos + (1*24*60*60)); // 2009-10-25 $d3 = date(Y-m-d, $gen_pos + (2*24*60*60)); // 2009-10-26 $d4 = date(Y-m-d, $gen_pos + (3*24*60*60));

[PHP] SQL - RANDOM

2008-11-24 Thread Korgan
Hi, i would ask what is the best method for random select from database. I have table with 20k items.. - If i use ,,select * from table order by rand() limit 3, the query took 0.0524 sec ... its slightly enough - but if i generate rand id and then i use ,,select where id

Re: [PHP] SQL - RANDOM

2008-11-24 Thread Korgan
thx it looks good [EMAIL PROTECTED] napsal(a): For large tables, I generally create a static_rand column, and pre-populated it with random numbers and create an index on it. Then, after using up the records, I have application logic to reset those records (and only those records) to new

Re: [PHP] Bug in array_key_exist?

2008-08-27 Thread Korgan
Korgan napsal(a): Jim Lucas napsal(a): Korgan wrote: Hi, I have a problem with array_key_exists in if statement. I have a class with this function class XXX { private items = array(); ... ... ... public function addXXX($id, $count) { $count = (int)$cout; Let me point

[PHP] Bug in array_key_exist?

2008-08-26 Thread Korgan
Hi, I have a problem with array_key_exists in if statement. I have a class with this function class XXX { private items = array(); ... ... ... public function addXXX($id, $count) { $count = (int)$cout; if (!array_key_exists($id, $this-items))

[PHP] Re: Bug in array_key_exist?

2008-08-26 Thread Korgan
Error reporting is set on E_ALL notice: it change value if I add the item which isnt in array Lupus Michaelis wrote: Korgan a écrit : public function addXXX($id, $count) { $count = (int)$cout; Try to work with error_reporting set to E_ALL ;) session_start(); var_dump

Re: [PHP] Bug in array_key_exist?

2008-08-26 Thread Korgan
Jim Lucas napsal(a): Korgan wrote: Hi, I have a problem with array_key_exists in if statement. I have a class with this function class XXX { private items = array(); ... ... ... public function addXXX($id, $count) { $count = (int)$cout; Let me point at it Check