<?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");
}
}
}
?>
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
Brother there is a ")" sign in line no 46,where is "(" this sign.
<?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
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
<?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 🙂