select , insert , update , delete Queries in core php

In this Chapter You Will Learnhow to select , insert , update , delete data from database using queries in core php

First We Have to create database and then create table



After creating database and table then we have to create PHP Script  to Retrieve values From HTML Form

";
echo "SutIdEmailPasswordMobileAddressGender    "; 

while(list($a,$b,$c,$d,$e,$f)=mysql_fetch_array($res))
{

echo "";    echo "".$a."";

echo "".$b."";

echo "".$c."";

echo "".$d."";

echo "".$e."";

echo "".$f."";

echo "Edit    Delete";

echo "";    

}

echo "";
}

// receive  value(value sent  using query string )

@$v=$_GET['chkid'];
@$email=$_GET['chk'];
if(isset($v))
{
mysql_query("delete from stuinfo where stu_id='$v'");
echo "records deleted";
}

if(isset($_POST['upd']))
{
$p=$_POST['p'];
$m=$_POST['mob'];
$add=$_POST['add'];
echo $email;

$upd="update stuinfo set pass='$p',mobile='$m',address='$add' where email='$email'";

mysql_query($upd);

echo "updated";

}

if(isset($_GET['chk']))
{
$sql="SELECT * FROM stuinfo where email='$email'";

$res=mysql_query($sql);

list($a,$b,$c,$d,$e,$f)=mysql_fetch_array($res);

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "";

echo "
Password
Mobile
Address
"; } ?>

HTML Form



Enter your email
Password
Mobile
Address
Gender Male Female
Hobbies cricket singing reading
Image
DOB