Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //this is for an example of an SQL select statement, creating a "preparation" for the SQL statement to be executed
- $select_userq = $link->prepare("SELECT * FROM login_user WHERE username = ? AND password = ?");
- //next is we bind the parameters to make sure which variables are to be inserted in the question marks
- $select_userq->bind_param("ss",$username,$password); //first comma is i for integer or s for string, etc.
- //this simply executes the prepared SQL statement
- $select_userq->execute();
- //this passes the variables that is selected from the select statement
- $select_userq->bind_result($user_id, $username, $password, $name, $email, $account_type, $college, $profile, $reference);
- //now we have created a list of the values passed
- echo $username . "<br>" . $password "<br><br>";
- //count number of rows, count if username and password exists
- $if_exists = $select_userq->num_rows;
- if($if_exists>0)
- {
- while($row = $select_userq->fetch()) //fetch
- {
- $user = $row['username'];
- $pass = $row['password'];
- echo "Uname:". $user;
- echo "Pass:" . $pass "<br>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement