In this post am going to explain how to write database connection and how to insert values in mysql table.Let's take a look .
Description
index.php
conn.php
<?php
$conn=mysql_connect("localhost","root","")or die('Database not connected');
$db=mysql_select_db("Your Database")or die('Database not connected');
?>
insert.php
<?php
if(isset($_POST['submit']))
{
$name=$_POST['namename'];
$number=$_POST['phonenumber'];
$address=$_POST['address'];
$insert=mysql_query("insert into ddtable(name,number,address)values('$name','$number','$address')");
}
?>
No comments:
Post a Comment