Wednesday, December 24, 2014

SIMPLE DATABASE CONNECTIVITY PROGRAM IN PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP DATABSAE</title>
</head>

<body>
<?php

$query=mysql_connect("localhost","root","");
mysql_select_db("cloud",$query) ;
$name1=$_POST['firstname'];
$name2=$_POST['lastname'];
//echo "insert into register(firstname,secondname)values('$name','$name2')";
$query1=mysql_query("INSERT into register(firstname,secondname)values('$name1','$name2')");
if($query1)
{
 echo "succesfully submitted";
 }
 else
 {
 echo "please submit again";
 }

?>
</body>
</html>

No comments:

Post a Comment