gpt4 book ai didi

php - fatal error : Uncaught Error: Call to undefined function mysql_connect()

转载 作者:可可西里 更新时间:2023-11-01 07:34:23 24 4
gpt4 key购买 nike

<分区>

我是初学者,也是文凭生... 请帮我解决这个错误...我尝试了很多在线解决方案但无济于事...我是 php 和 mysql 的新手...

<?php

$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="slr"; // Database name
$tbl_name="software"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$soft_name=$_POST['soft_name'];
$installed_date=$_POST['installed_date'];
$expiry_date=$_POST['expiry_date'];
$product_key=$_POST['product_key'];
// Insert data into mysql
$sql="INSERT INTO $software(soft_name, installed_date, expiry_date, product_key)VALUES('$soft_name', '$installed_date', '$expiry_date', '$product_key')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='CreateData.php'>Back to main page</a>";
} else {
echo "ERROR";
}
// close connection
mysql_close();
?>

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com