Code for Database Connection confirmation PHP+HTML
<html>
<head>
<title> web page 2</title>
</head>
<body>
<?php
error_reporting(0);
$con=mysql_connect("localhost","root","");
if($con){
mysql_select_db('one',$con);
echo "connection successfully";
}
else{
echo "connection fail";
}
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$password=$_REQUEST['password'];
$query="INSERT INTO `db1`.`one` (`id`, `name`, `email`, `password`) VALUES (NULL, '$name', '$email', '$password'); ";
$r = mysql_query($query);
if($r)
{echo "inserted";}
else
{echo "error";}
?>
</body>
</html>
<head>
<title> web page 2</title>
</head>
<body>
<?php
error_reporting(0);
$con=mysql_connect("localhost","root","");
if($con){
mysql_select_db('one',$con);
echo "connection successfully";
}
else{
echo "connection fail";
}
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$password=$_REQUEST['password'];
$query="INSERT INTO `db1`.`one` (`id`, `name`, `email`, `password`) VALUES (NULL, '$name', '$email', '$password'); ";
$r = mysql_query($query);
if($r)
{echo "inserted";}
else
{echo "error";}
?>
</body>
</html>
Comments
Post a Comment