Click here to Skip to main content
14,694,292 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if(isset($_POST['pinSend'])){
	
	$userid=$_POST['userid'];
	$pinNo=$_POST['pinNo'];
	
	
	$x=1;
	
	while($x<=$pinNo) {
		
		$pint=pin_generate();
		$pinsql="INSERT INTO `pin_list`(`userid`, `pin`, `pinAmt`, `pinNo`, `status`) VALUES ('$userid', '$pint', '100', '$pinNo', '1')";
		$run=mysqli_query($db,$pinsql);
		
		  $x++;
          ?>

          <script>
		
          alert('E-pin Generated successfully');
          </script>
        <?php

			
	}
	
    }
	
	//Function for pin Generate
	function pin_generate() {
		
		global $db;
		$pint=mt_rand(10000, 9999999);
		$sql="SELECT * FROM pin_list where pin='$pint'";
		$run=mysqli_query($db,$sql);
		if(mysqli_num_rows($run)>0); {
			
			pin_generate();
			
	    }
		else {
			
			return $pint;
		}
		
		    
	}
	
	?>


What I have tried:

i tried but same error occurs i can't understand the error any one help me to solve this issue.
Posted
Updated 30-Aug-20 9:52am

It looks like there is a spurious semicolon in this line:
if(mysqli_num_rows($run)>0); {
   
v2
if(mysqli_num_rows($run)>0); {
                           ^ remove semicolon here
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900