• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need the number of seconds since....

#11
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/Universall...4_(random)

Generated with random_bytes.
http://php.net/manual/en/function.random-bytes.php
Reply

#12
Thanks. I am going to try random_bytes(8). The combo of my sort field and my campaign field should be pretty unique.
proof that an old dog can learn new tricks
Reply

#13
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
proof that an old dog can learn new tricks
Reply

#14
You need PHP 7+.
Reply

#15
You can also get a unique number using the below.

PHP Code:
$data openssl_random_pseudo_bytes(16); 

It is part of PHP.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#16
That worked great. thx
proof that an old dog can learn new tricks
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.