Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

prepared statement

Sanam SitoulaSanam Sitoula Member Posts: 2

why this prepared statement is not fetching data from sql my php is 5.6.12 ? thanks in advance

<?php include_once'../header.php' ?>
<?php if (isset($_POST['Submit'])) { $employeer_login_username = mysql_real_escape_string($_POST['employeer-login-username']); $employeer_login_password = md5($_POST['employeer-login-password']); $con = mysqli_connect('localhost','root','','awasar') or die('Unable To connect'); $sql="SELECT username,password FROM employeer_registration WHERE username = ? AND password = ?"; if($stmt = mysqli_prepare($con,$sql)){ /* Binds variables to prepared statement i corresponding variable has type integer d corresponding variable has type double s corresponding variable has type string b corresponding variable is a blob and will be sent in packets */ $stmt->bind_param("ss",$employeer_login_username,$employeer_login_password); /* execute query */ $stmt->execute(); /* Get the result */ $result = $stmt->get_result(); /* Get the number of rows */ $num_of_rows = $result->num_rows; while ($row = $result->fetch_assoc()) { echo 'ID: '.$row['organizationname'].'
'; echo 'First Name: '.$row['username'].'
'; echo 'Last Name: '.$row['primaryemail'].'
'; echo 'Username: '.$row['designation'].'

'; } /* free results */ $stmt->free_result(); /* close statement */ $stmt->close(); } /* close connection */ mysqli_close($con); } ?>

Welcome Back! Please Sign In







Tagged:

Comments

Sign In or Register to comment.