Urgent Help for PHP 5 error

Discussion in 'PHP' started by great_friend, Apr 28, 2010.

Thread Status:
Not open for further replies.
  1. #1
    Hi Any php expert here for fix my problem

    Error in php 5 is
    Notice: Undefined variable: code in G:\wamp\www\projects\handicraftcorner\include\functions.php on line 58

    Notice: Undefined variable: code in G:\wamp\www\projects\handicraftcorner\include\functions.php on line 58

    In function.php I am using this code

    for ($i=0;$i<$mach;$i++)
    	{
    		unset ($code);
    		$ids = array_rand ($let, $num);
    		foreach ($ids as $val)
    		$code .=$let[$val];
    		$return=strtoupper($code);
    	}
    PHP:
    Any one help me ? I need urgent help

    Thanks in advance
     
    Last edited: Apr 28, 2010
    great_friend, Apr 28, 2010 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,901
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    It is saying that when the script gets to line 58 $code has no value.

    So... is line 58 where you try to unset it? or where you try to add a value to it.

    I'd recommend trying
    for ($i=0;$i<$mach;$i++)
    	{
    		$code = '';
    		$ids = array_rand ($let, $num);
    		foreach ($ids as $val) $code .= $let[$val];
    		$return=strtoupper($code);
    	}
    PHP:
     
    sarahk, Apr 28, 2010 IP
  3. great_friend

    great_friend Active Member

    Messages:
    377
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Yes Now resolved Thanks sarah

     
    great_friend, Apr 28, 2010 IP
Thread Status:
Not open for further replies.