Welcome Guest, Not a member yet? Register   Sign In
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 post was last modified: 08-15-2018, 10:04 AM by richb201.)

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




Theme © iAndrew 2016 - Forum software by © MyBB