Kipkip
Join the Revolution
- 967
- Posts
- 21
- Years
- Age 34
- Seen Jun 24, 2007
PHP:
<?php
class MySQL
{
var $row;
function add_cat($name)
{
$insert = "INSERT INTO Catergories(Name) VALUES ($this->name)";
if(mysql_query($this->insert)){
return true;
}else{
return false;
}
}
function show_cat()
{
$query = mysql_query("SELECT ID, Name FROM Catergories ORDER BY Name");
while ($this->row = mysql_fetch_array($this->query) or die(mysql_error())){
$id = $this->row['id'];
$name = $this->row['name'];
print("<a href=\"?delete=$this->id\">$this->name</a><br />");
}
}
function delete_cat( $id )
{
$query = "DELETE FROM Catergories WHERE ID = $this->id";
if(mysql_query($this->query)){
return true;
}else{
return false;
}
}
}
?>
Help. I'm just learning OOP.Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/kipkip/public_html/news/admin/function_list_cat.php on line 17