Click here to Skip to main content
14,664,481 members
Rate this:
Please Sign up or sign in to vote.
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 8:52am

Rate this:
Please Sign up or sign in to vote.

Solution 1

It looks like there is a spurious semicolon in this line:
if(mysqli_num_rows($run)>0); {
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100