Submitted by: Submitted by janjan1919
Views: 230
Words: 592
Pages: 3
Category: Other Topics
Date Submitted: 10/25/2013 12:23 AM
Add record – Insert sql query
List record - Select sql query
Edit record - update sql query
Delete record - delete sql query
There are four php files are used here to do this operations.
config.php
add.php
list.php
edit.php
delete.php
Database
DATABASE NAME : freeze_demo
TABLE NAME: addd
FIELDS: id(primary key with auto increment), name, age
Stylesheet
<style type="text/css">
td
{
padding:5px;
border:1px solid #ccc;
}
</style>
-------------------------------------------------
PHP Code to Add Edit List Delete Record
Here is the simple php code for add, list, edit and delete record
config.php
<?php
$query=mysql_connect("localhost","root","");
mysql_select_db("freeze_demo",$query);
?>
add.php
<html>
<body>
<?php
include('config.php');
if(isset($_POST['submit']))
{
$name=mysql_real_escape_string($_POST['name']);
$age=mysql_real_escape_string($_POST['age']);
$query1=mysql_query("insert into addd values('','$name','$age')");
echo "insert into addd values('','$name','$age')";
if($query1)
{
header("location:list.php");
}
}
?>
<fieldset style="width:300px;">
<form method="post" action="">
Username: <input type="text" name="name"><br>
Age: <input type="text" name="age"><br>
<br>
<input type="submit" name="submit">
</form>
</fieldset>...