The following articles mainly use the actual application code to introduce the actual authentication operations of form php MySQL. We often use form php MySQL in actual operations, the following articles describe how to perform identity authentication.
- <?php
- $uname=$_POST["username"];
- $pwd=$_POST["password"];
- $link = MySQL_connect('localhost', 'root', '123456')
- or die('Could not connect: ' . MySQL_error());
- MySQL_select_db('ruida') or die('Could not select database');
Execute SQL query
- $query = 'SELECT * FROM user';
- $result = MySQL_query($query) or die('Query failed: ' . MySQL_error());
- while($row=MySQL_fetch_array($result)){
- if($uname==$row['username'] && $pwd==$row['password'])
- {
Page Jump
- }
- else
- echo 'error!';}
Release result set
- MySQL_free_result($result);
Close connection
- MySQL_close($link);
- ?>
The above content describes how to implement authentication for form php MySQL.