Welcome Guest, Not a member yet? Register   Sign In
" Undefined variable" message when I am trying to create custom library.
#1

[eluser]Unknown[/eluser]
This is my library
class Testing extends CI_Loader {

function __construct() {

function randomtxt($n){
$codelenght = $n;
while($newcode_length < $codelenght) {
$x=1;
$y=3;
$part = rand($x,$y);
if($part==1){$a=48;$b=57;} // Numbers
if($part==2){$a=65;$b=90;} // UpperCase
if($part==3){$a=97;$b=122;} // LowerCase
$code_part=chr(rand($a,$b));
$newcode_length = $newcode_length + 1;
$newcode = $newcode.$code_part;
}
return $newcode;
}
}

I am trying to call in my controller..
$this->load->library('testing');
echo $this->testing->randomtxt(12);
I am gettig fallowing error:
Message: Undefined variable: newcode_length
Please help me..
Thank you.



Messages In This Thread
" Undefined variable" message when I am trying to create custom library. - by El Forum - 08-07-2012, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB