954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need To Create unique Number by givven user input

friends i want to create a array which contain no of unique key , it also need store in mysql database , which i have done on my wamp server but when i m running this code on web server online i getting that my page will hangup .......so please help me....
code

$no_of_pin=$_POST['no_pin'];
	$pin_cost=$_POST['pin_cost'];
	if(($no_of_pin!=null) && ($pin_cost!=null))
	{
		for($a=0;$a<$no_of_pin;)
		{
			$pin=mt_rand(1000000,9999999999);
			$qry=$obj->ex_query("select pin_id from uapl_pin where pin_id=$pin")or die();
			if($qry==1)
			{
				$a--;
			}
			else
			{ 
				$qry=$obj->ex_query("insert into uapl_pin values($pin,$pin_cost,'unused','$date','')")or die();
				if($qry>0)
				{
				   $prt_pin[$a]=$pin;
				   $a++;
				}
			}
			
		}
	}
	else
	{
		$mgs="Please Enter The value First.";
	}


plase help its urgent live project

peterpa
Newbie Poster
20 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

please help me its very urgentttttttttttt

peterpa
Newbie Poster
20 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

please guys help me its really urgent.....

peterpa
Newbie Poster
20 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

I think you has infinite loop iteration. echo your line 7 as

echo $pin=mt_rand(1000000,9999999999);


and check what happens?

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

your $qry in line 8 is always returns 1. that's why the iteration takes place and hanging up. Check that line

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

use
break;
after line no 11.
And check your output.

divyakrishnan
Posting Whiz in Training
201 posts since May 2010
Reputation Points: 30
Solved Threads: 24
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: