Current location: Hot Scripts Forums » Programming Languages » PHP » PHP delete from MySQL Error (PHP ERROR)

PHP delete from MySQL Error (PHP ERROR)

 
Prev Previous Post   Next Post Next
  #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;    
            }

            
            
            



        }
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS MYSQL and PHP nommiiss PHP 6 01-31-06 05:30 PM
WEB HOSTING - $4.99/MONTH For 1GB HD & 25GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 12-10-05 09:13 AM
single quote "'" error in mysql query by php sjems PHP 4 09-27-05 09:36 AM
Delete files/directories selected in MySQL ronlar PHP 3 08-08-05 09:41 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-25-05 12:09 AM


All times are GMT -5. The time now is 09:36 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.