1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| function Book($id) {
$this->id = $id;
$db = database_connect();
$sql =
"SELECT holder.username AS holder, holder.feedback AS holderFeedback, " .
"u.username, u.address, u.apartment, u.feedback, u.zipcode, " .
"l.status, l.current_holder, l.date_back, " .
"l.authorfirst, l.authorlast, l.title, l.review, l.section " .
"FROM dlp_library l, dlp_user u " .
"LEFT JOIN dlp_user holder ON (l.current_holder = holder.id) " .
"WHERE l.id = '$id' AND l.user_id = u.id";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_array($result)) {
$this->owner = safeHTML($row["username"]);
$this->address = safeHTML($row["address"]);
$this->apartment = safeHTML($row["apartment"]);
$this->feedback = safeHTML($row["feedback"]);
$this->zipcode = safeHTML($row["zipcode"]);
$this->status = safeHTML($row["status"]);
$this->current_holder = safeHTML($row["current_holder"]);
$this->date_back = safeHTML($row["date_back"]);
$this->authorfirst = safeHTML($row["authorfirst"]);
$this->authorlast = safeHTML($row["authorlast"]);
$this->title = safeHTML($row["title"]);
$this->review = safeHTML($row["review"]);
$this->section = safeHTML($row["section"]);
$this->holder = safeHTML($row["holder"]);
$this->feedback = safeHTML($row["feedback"]);
}
} |
Partager