how to fix the error in line 41....plz help me

Started on the old forum in February 2011 · view the original in the archive · old links redirect here

3 replies · 479 views · started 15 years ago · 1 min read

2 participants
godfathersis Junior · 35 posts #1
<?php

class Gift {

    // define properties
    public $gid;
	public function __construct() {
		$this->gid = null;
		$this->fields = array( 	'title' => '',
								'image' => '',
								'price' => 0,
								'category_title' => '');
	}

	// return an object populated based on the record's user id
	public static function getById($gift_id) {

		$gift = new Gift();

		$row = mysql_fetch_assoc($res);

		$gift->gid = $gift_id;
		$gift->image = $row[gImage];
		$gift->price = $row[gPrice];
		$gift->hit = $row[gHit];
		$gift->category = $row[gCat];
	
		$rs = query("SELECT * FROM `gifts_category` WHERE `catid`=$row[gCat]");
		$rw = mysql_fetch_assoc($rs);

		$gift->category_title = $rw[catTitle];

		mysql_free_result($res);
		return $gift;
	}

	// save the record to the database
	public function save() {

				`gTitle`=\"$this->title\",
				`gImage`=\"$this->image\",
				`gPrice`=$this->price,
				`gHit`=$this->hit,
				`gCat`=$this->category
				 	WHERE `gid`=$this->gid");
		}
	}

}

?>
godfathersis Junior · 35 posts #2

Brother there is a ")" sign in line no 46,where is "(" this sign.

hidden wrote:

<?php 


class Gift { 

    // define properties 
    public $gid; 
    public function __construct() { 
        $this->gid = null; 
        $this->fields = array(     'title' => '', 
                                'image' => '', 
                                'price' => 0, 
                                'category_title' => ''); 
    } 

    // return an object populated based on the record's user id 
    public static function getById($gift_id) { 

        $gift = new Gift(); 

        $row = mysql_fetch_assoc($res); 

        $gift->gid = $gift_id; 
        $gift->image = $row[gImage]; 
        $gift->price = $row[gPrice]; 
        $gift->hit = $row[gHit]; 
        $gift->category = $row[gCat]; 
     
        $rs = query("SELECT * FROM `gifts_category` WHERE `catid`=$row[gCat]"); 
        $rw = mysql_fetch_assoc($rs); 

        $gift->category_title = $rw[catTitle]; 

        mysql_free_result($res); 
        return $gift; 
    } 

    // save the record to the database 
    public function save() { 

               `gTitle`="$this->title\",
                `gImage`="$this->image\", 
                `gPrice`=$this->price, 
                `gHit`=$this->hit, 
                `gCat`=$this->category 
                     WHERE `gid`=$this->gid"); 
        } 
    } 

} 

?>

red line is line 41

but error fixed may b try code

godfathersis Junior · 35 posts #3

yes bro...

Added after 3 minutes:

itz a facebook gift store application script.that script was full of bugs.i fixed most of them without Gift.php page.if anybody interested tell me i will send u that script ,if u can fix it then send me a copy also

wap2k Developer · 168 posts #4
<?php

class Gift { 

    // define properties 

    public $gid; 

    public function __construct() { 
        $this->gid = null; 
        $this->fields = array(     
				'title' => '', 
				'image' => '', 
                                'price' => 0, 
                                'category_title' => ''
			    ); 
    } 

    // return an object populated based on the record's user id 

    public static function getById($gift_id) { 
        $gift = new Gift(); 
        $row = mysql_fetch_assoc($res); 
        $gift->gid = $gift_id; 
        $gift->image = $row["gImage"]; 
        $gift->price = $row["gPrice"]; 
        $gift->hit = $row["gHit"]; 
        $gift->category = $row["gCat"];      
        $rs = query("SELECT * FROM `gifts_category` WHERE `catid`=$gift->category"); 
        $rw = mysql_fetch_assoc($rs); 
        $gift->category_title = $rw["catTitle"]; 
        mysql_free_result($res); 
        return $gift; 
    } 

    // save the record to the database 
    public function save() { 
       mysql_query("UPDATE 'gifts_category' SET 
                `gTitle` = ".$this->title.",
                `gImage` = ".$this->image.", 
                `gPrice` = $this->price, 
                `gHit`   = $this->hit, 
                `gCat`   = $this->category 
                 WHERE `gid` = $this->gid"); 
        } 
    } 

?>

Here you go i fixed all the errors i could find 🙂

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close