Welcome Guest, Not a member yet? Register   Sign In
keep getting an error even though everything seems to work perfectly - dont know how to get rid of it.
#1

[eluser]netameta1[/eluser]
I have this and other function on a library that i have.
When i call this function from the main controller i keep getting this notice error i cant figure our why.. nothing i do will remove it.

Also how do i remove notices ?

This is the error message
Code:
A PHP Error was encountered

Severity: Notice

Message: Uninitialized string offset: 36

Filename: libraries/Oneclick.php

Line Number: 36
This is the function.
Code:
function genRandomString()
    {
        $length = 25;
        $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
        $x=0;
        $string = "";
        while($x != 1 )
        {
            for ($p = 0; $p < $length; $p++)
            {
                $string.= $characters[mt_rand(0, strlen($characters))];
            }
            $query = $this->CI->db->query('SELECT * FROM `users` WHERE `vernum` = \''.$string.'\'');
            if($query->num_rows() <= 0)
            {
                $x=1;
            }
        }
        return $string;
    }




Theme © iAndrew 2016 - Forum software by © MyBB