Click here to Skip to main content
15,894,405 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 8:52am
Comments
[no name] 5-Jun-22 3:42am    
Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\xampp\htdocs\project\admin\select_project.php on line 170










Add Student Details


Back


0)
{

foreach($sql_run as $sql)

{
?>





Student 1*




Roll No*




Email*




Student 2*




Roll No*




Email*




Program

--please Select--






Semester

--please Select--







Session

--please Select--













Project Details






Project Title




About_project




Area




Tools




Other




Supervisor

--please Select--










Submit








No Record Found


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

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