how to delete records in my database in mysql fo php
Posted: Tue Aug 30, 2011 8:40 am
if (isset($_POST['submitted'])){
{
$nam = $_POST['search'];
mysql_connect("localhost","root","");
mysql_select_db("sample");
$qry = "delete from student where sNumber='$nam'";
$res = mysql_affected_rows(mysql_query); // If user name exists, this will return number of rows fetched.
if ($res = 0) // If 0, then username doesnot exist
{
echo " No id found";
}
else
{
$qry = "delete from student where sNumber='$nam'";
$res = mysql_query($qry);
if (@mysql_query($qry))
{ echo("<br/><br/>Record Removed!</p>"); }
else
{ echo("<br/><br/>Error deleteing: " . mysql_error() . "</p>"); }
}
}
here is my code....there is a problem here...can someone help me..plz...thanx for advnce...
{
$nam = $_POST['search'];
mysql_connect("localhost","root","");
mysql_select_db("sample");
$qry = "delete from student where sNumber='$nam'";
$res = mysql_affected_rows(mysql_query); // If user name exists, this will return number of rows fetched.
if ($res = 0) // If 0, then username doesnot exist
{
echo " No id found";
}
else
{
$qry = "delete from student where sNumber='$nam'";
$res = mysql_query($qry);
if (@mysql_query($qry))
{ echo("<br/><br/>Record Removed!</p>"); }
else
{ echo("<br/><br/>Error deleteing: " . mysql_error() . "</p>"); }
}
}
here is my code....there is a problem here...can someone help me..plz...thanx for advnce...