Friday, January 10, 2014

Registration Form: Inserting Data in PHP Database

 How To Insert New Data In Data Base In PHP

Sample Code
<html>
<head>
<title>Registration form</title>
</head>
<body>
<?php
$con=mysql_connect("localhost","root","");
$mysql_select_db("kiu");
$result=mysql_query("select * from student");
while($row=mysql_fetch-array($result))
if(mysql_connect_errno())
{
echo:"Failed tro connect to database".mysql_connect_error();
}
else
{
$sql:"INSERT INTO student values('$Reg_no','$Name','$F.name', '$password','$D_o_B','$Email')";

$query = mysql_query($sql);
if($query)
     echo $name . " has been added successfully";
else
echo "There was an error while inserting user to the database.";
}


</table>
</body>


</html>

Related Posts:

  • PHP code for Personal information PHP code for Inserting Personal information <!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">… Read More
  • Data base connectivity code Data base connectivity code In PHP <?php $host = "localhost"; //12.23.1212. $usrname = "root"; $pass = '';      mysql_connect($host, $usrname, $pass); mysql_select_db("loginsystem"); session_start()… Read More
  • CSS code for image slider/* For generic page styles. Not for sliders. */ body {background:#F6F6F6;font:normal 0.9em Arial; margin:0; padding:0; padding-bottom:60px;} h2 {display:inline;} .div1, .div2 {width:700px;margin:0 auto;} .div1 {margin-top:30… Read More
  • PHP Code for Inserting Data<html> <head> <style type="text/css">     ul {     list-style: none;     margin: 0;     }     li {     float: left;     }     … Read More
  • CSS code for image slider/* For generic page styles. Not for sliders. */ body {background:#F6F6F6;font:normal 0.9em Arial; margin:0; padding:0; padding-bottom:60px;} h2 {display:inline;} .div1, .div2 {width:700px;margin:0 auto;} .div1 {margin-top:30… Read More

0 comments:

Post a Comment