need the number of seconds since.... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: need the number of seconds since.... (/showthread.php?tid=71441) Pages:
1
2
|
RE: need the number of seconds since.... - jreklund - 08-15-2018 It's not a unique value: http://php.net/manual/en/function.uniqid.php That's why I'm using uuidv4. https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random) Generated with random_bytes. http://php.net/manual/en/function.random-bytes.php RE: need the number of seconds since.... - richb201 - 08-15-2018 Thanks. I am going to try random_bytes(8). The combo of my sort field and my campaign field should be pretty unique. RE: need the number of seconds since.... - richb201 - 08-15-2018 This line is failing: $data['date_time']=random_bytes(8); //this is to create a unique number When I step through this line with the debugger, the code just crashes. (ie it gets stuck at this line). I am getting this apache error: PHP Fatal error: Call to undefined function random_bytes() in C:\\xampp\\htdocs\\sub_crud\\application\\controllers\\Subit_backend.php on line 364 RE: need the number of seconds since.... - jreklund - 08-15-2018 You need PHP 7+. RE: need the number of seconds since.... - InsiteFX - 08-16-2018 You can also get a unique number using the below. PHP Code: $data = openssl_random_pseudo_bytes(16); It is part of PHP. RE: need the number of seconds since.... - richb201 - 08-16-2018 That worked great. thx |