时间:2021-07-01 10:21:17 帮助过:2人阅读
简单学习PHP向MYSQL中插入数据的代码
$dbhost = localhost;
$dbuser = webjxcom; //你的mysql用户名
$dbpass = 123456; //你的mysql密码
$dbname = database; //你的mysql库名
//连接本地数据库
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
if ($conn) {
echo "连接数据库成功";
} else {
echo "连接数据库失败";
}
//打开数据库
mysql_select_db($dbname,$conn);
//插入数据
$sql="insert into test(test) values(ddddddd)";
$result=mysql_query($sql,$conn)or die(mysql_error());
echo "打开数据库";
//关闭数据库
mysql_close($conn);
?>
http://www.bkjia.com/PHPjc/531664.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/531664.htmlTechArticle简单学习PHP向MYSQL中插入数据的代码 ?php $dbhost = localhost; $dbuser = webjxcom; //你的mysql用户名 $dbpass = 123456; //你的mysql密码 $dbname = database; //你的...