<?php //创建数据表user $servername="localhost"; $username="root"; $userpassword="123456"; $dbname = "testbook"; $connent=new mysqli($servername,$username,$userpassword,$dbname); if($connent->connect_error){ die("连接失败: " . $connent->connect_error); }else{ echo "连接成功"; } //创建表 原生的建表语句 id自增唯一 name age email $createtable="create table testuser ( user_id int(10) not null auto_increment primary key, user_name varchar(18) not null unique, user_psw varchar(32) not null, user_phone varchar(11) null, user_type tinyint(1) not null default 0, user_account float not null default 0 )"; if($connent->query($createtable)==true){//执行 echo "创建表testuser成功"; }else{ echo "Error creating table: " . $connent->error; }?>续写实现md5对密码进行加密
时间: 2024-03-29 08:37:38 浏览: 92
<?php
//创建数据表user
$servername="localhost";
$username="root";
$userpassword="123456";
$dbname = "testbook";
$connent=new mysqli($servername,$username,$userpassword,$dbname);
if($connent->connect_error){
die("连接失败: " . $connent->connect_error);
}else{
echo "连接成功";
}
//创建表 原生的建表语句 id自增唯一 name age email
$createtable="create table testuser (
user_id int(10) not null auto_increment primary key,
user_name varchar(18) not null unique,
user_psw varchar(32) not null,
user_phone varchar(11) null,
user_type tinyint(1) not null default 0,
user_account float not null default 0
)";
if($connent->query($createtable)==true){//执行
echo "创建表testuser成功";
}else{
echo "Error creating table: " . $connent->error;
}
// 对密码进行加密
$password = "123456";
$encrypted_password = md5($password);
?>
阅读全文