Home > Backend Development > PHP Tutorial > php+mysql implements authentication code_PHP tutorial

php+mysql implements authentication code_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:40:01
Original
1086 people have browsed it

Copy code The code is as follows:

$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 the result set
mysql_free_result($result);
//Close the connection
mysql_close($link);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321444.htmlTechArticleCopy the code as follows: ?php $uname=$_POST["username"]; $pwd=$_POST[ "password"]; $link = mysql_connect('localhost', 'root', '123456') or die('Could not connect: ' . mysql_error(...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php - mysql monitoring problem
From 1970-01-01 08:00:00
0
0
0
PHP toolbox mysql cannot start
From 1970-01-01 08:00:00
0
0
0
How to upgrade mysql in php toolbox
From 1970-01-01 08:00:00
0
0
0
Can the php toolbox change the mysql version?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template