There is a code of crud operations in php using classes. plz help me to correct the error
Warning: mysql_query() expects parameter 1 to be string, resource given in C:\wamp\www\new\customers.php on line 44
<?php
class Customers
{
private $name;
private $id;
private $desc;
private $con;
public function __construct($name,$desc)
{
$this -> name = $name;
$this-> desc = $desc;
$this -> con = mysql_connect("localhost", "root", "");
$this -> db = mysql_select_db('cust');
}
public function insertData()
{
$sql = " insert into desc_tbl values ( 'name','desc')";
$res = mysql_query($sql);
mysql_query($res);
echo "<center>Record Inserted</center><br>";
}
public function deleteData($id)
{
$sql = " delete from desc_tbl where id='$id'";
$res = mysql_query($sql);
mysql_query($res);
}
public function fetchData($id)
{
$sql = " select * from desc_tbl where id='$id'";
$res = mysql_query($sql);
mysql_query($res);
}
public function updateData($name, $desc, $id)
{
$sql = " update desc_tbl set name='$name' , desc='$desc' where id='$id'";
$res = mysql_query($sql);
mysql_query($res);
echo "<center>Record Updated</center><br>";
}
}
?>
test.php
<?php
require_once("customers.php");
{
$name = "John";
$desc ="Test Desc";
$c = new Customers($name,$desc);
$id = $c->insertData($desc);
echo "New Id is " .$id, '<br>';
$c = new Customers($name, $desc);
$id = $c -> deleteData($id);
echo "<center>Record Deleted</center>" .$id, '<br>';
$c = new Customers($name,$desc);
$id = $c -> fetchData($id);
echo "Result is" .$id, '<br>';
$c = new Customers($name,$desc, $id);
$id = $c -> updateData($name,$desc,$id);
echo "Updated Record is" .$id;
}
?>