Simply learn PHP code to insert data into MYSQL_PHP tutorial

WBOY
Release: 2016-07-13 17:29:34
Original
752 people have browsed it

Easyly learn the code to insert data into MYSQL from PHP

$dbhost = localhost;
$dbuser = webjxcom; //Your mysql username
$dbpass = 123456; //Your mysql password
$dbname = database; //Your mysql library name

//Connect to local database
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
if ($conn) {
echo "Connect to database successfully";
} else {
echo "Failed to connect to database";
}
//Open the database
mysql_select_db($dbname,$conn);
//Insert data
$sql="insert into test(test) values(ddddddd)";
$result=mysql_query($sql,$conn)or die(mysql_error());

echo "Open database";
//Close database
mysql_close($conn);
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531664.htmlTechArticleEasyly learn PHP code to insert data into MYSQL?php $dbhost = localhost; $dbuser = webjxcom; // Your mysql username $dbpass = 123456; //Your mysql password $dbname = database; //Your...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template