View Single Post
  #1 (permalink)  
Old 01-31-07, 12:29 AM
_matt _matt is offline
Newbie Coder
 
Join Date: Oct 2006
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow PHP delete from MySQL Error (PHP ERROR)

I get this error
PHP Code:

Fatal errorCall to a member function on a non-object in /home/httpd/vhosts/xyz.com/httpdocs/casa/catalogclass.php on line 109 

here is the code Im using. (I am new to this please be easy)
PHP Code:

<?

    
require_once "databaseclass.php";


    class 
catalogclass extends databaseclass{
        
        var 
$thumbnail;
        var 
$mainpic;
        var 
$description;    
        var 
$directory;
        var 
$directory1;
        var 
$pagesize;
        var 
$pageindex=0;
        var 
$rows;
        var 
$rowcount;
        var 
$i=0;
        var 
$row;
        var 
$condition;
        var 
$category;
        var 
$command;
    
 
        function 
setThumbnail($value){
        
            
$this->thumbnail=$value;
        
        }

        function 
setMainPic($value){
        
            
$this->mainpic=$value;
        
        }

        function 
setDescription($value){
        
            
$this->description=$value;
        
        }

        function 
setDirectory($value){
        
            
$this->directory=$value;
        }
        function 
setDirectory1($value){
        
            
$this->directory1=$value;
        }

        
        function 
setPageSize($value){
        
            
$this->pagesize=$value;
        
        }
        

        function 
setPageIndex($value){
        
            
$this->pageindex=$value-1;
        
        }
        function 
getSearch(){
            
            return 
$this->queryME("select * from Catalog WHERE title LIKE '%$search%' || description LIKE '%search%' || category LIKE '%$search%'");            
            
        }

        function 
getCategories(){
            
            return 
$this->queryME("SELECT category from Catalog group by category");            
            
        }
        
        function 
setCategory($value){

            
$this->category=$value;

        }


        function 
display(){    

            
$this->indexSize();        
            
$this->i=0;
            
            
            if(
$this->category=="All"){
                
$this->command="SELECT Mainpic,Description,Category,Height,Width,Depth,Location,Title,Price,Main2,Main3,Main4,Itemid from Catalog order by rand() limit 4" ;
            }else{
                
$this->command="SELECT Mainpic,Description,Category,Height,Width,Depth,Location,Title,Price,Main2,Main3,Main4,Itemid from Catalog WHERE category = '".$this->category."' limit ".$this->pageindex*$this->pagesize.",".$this->pagesize;
            }
            
$this->rows=$this->queryME($this->command);
            
$horizontal=0;
            print 
"<table  width=\"576\" aling=\"center\">";
            while(
$this->row mysql_fetch_assoc($this->rows)){
                if(
$horizontal%4==0)
                    print 
"<tr valign=top>";
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<td valign="top"><table border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td valign="top"><div align="center"><a href="display.php?mainpic=<? print $this->directory1."/".$this->row[Mainpic];?>&title=<? print $title str_replace(" ","%20",$this->row[Title]);?>&price=<? print $this->row[Price];?>&height=<? print $this->row[Height];?>&width=<? print $this->row[Width];?>&depth=<? print $this->row[Depth];?>&location=<? print $location str_replace(" ","%20"$this->row[Location]);?>&description=<? print $description str_replace(" ","%20"$this->row[Description]);?>&main2=<? print $this->row[Main2];?>&main3=<? print $this->row[Main3];?>&main4=<? print $this->row[Main4];?>"><img src="<? print $this->directory."/".$this->row[Mainpic];?>" width="125" height="125" border="5" style="border-color:#B3B0B0" /></a></div></td>
    </tr>
    <tr>
      <td><div align="center" class="titlec"><? print $this->row[Title];?>/<? print $this->row[Itemid];?></div></td>
    </tr>
    <tr>
      <td><? if($_POST['delete']){
$row=$databaseobject->queryMe("DELETE FROM Catalog where itemid ='$itemid'");
};
?>
        <form action="<?php echo $PHP_SELF?>" method="post" name="delete">
          <input type="hidden" name="itemid" value="<? print $this->row[Itemid];?>" />
          <input name="delete" type="submit" value="delete" />
        </form></td>
    </tr>
  </table></td>
<? if($horizontal%4==3){
                    print 
"</tr>";
                }

                
$this->i++;
                if(
$this->i>=$this->pagesize){
                    break;
                }
                
$horizontal++;
            }
            print 
"</table>";
            
$this->indexSize();

            
        }

        function 
indexSize(){


            if(
$this->category!="All" && $this->category!=""){
                
$this->rows=$this->queryME("SELECT count(*) as size from Catalog where category='".$this->category."'");
            }else{
                
$this->rows=$this->queryME("SELECT count(*) as size from Catalog");
            }


            
$this->rowcount=mysql_fetch_assoc($this->rows);
            if(
$this->rowcount[size]%$tihs->pagesize>&& $this->rowcount[size]>$this->pagesize){
                
$this->condition=($this->rowcount[size]/$this->pagesize) + 1;
            } else{    
                
$this->condition=$this->rowcount[size]/$this->pagesize;    
            }

            
            
            



        }
}

?>
Reply With Quote