function getLikes($picID) { $sqlQuery = "SELECT photograph_id FROM votes "; $sqlQuery .= "WHERE photograph_id ={$picID}"; $photographsQuery = Photograph::find_by_sql($sqlQuery); echo sizeof($photographsQuery); }
// 1. the current page number ($current_page) $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1; // 2. records per page ($per_page) $per_page = 3; // 3. total record count ($total_count) $total_count = Photograph::count_all(); // Find all photos // use pagination instead //$photos = Photograph::find_all(); $pagination = new Pagination($page, $per_page, $total_count); // Instead of finding all records, just find the records // for this page $sql = "SELECT * FROM photographs "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $photos = Photograph::find_by_sql($sql); // Need to add ?page=$page to all links we want to // maintain the current page (or store $page in $session) ?> <?php include_layout_template('header.php'); ?> <?php foreach ($photos as $photo) { ?> <div style="float: left; margin-left: 20px;"> <a href="photo.php?id=<?php echo $photo->id; ?>
require_once '../includes/initialize.php'; ?> <?php include_layout_template("header.php"); $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $record_no = 3; $total_records = Photograph::count(); // $photo_object = new Photograph(); // $photos = $photo_object->find_all(); $pagination = new Pagination($page, $record_no, $total_records); $sql_query = "SELECT * FROM photograph "; $sql_query .= "LIMIT {$record_no} "; $sql_query .= "OFFSET {$pagination->offset()} "; $photos = Photograph::find_by_sql($sql_query); ?> <h2>Photos</h2> <?php echo output_message($session->set_get_message()); ?> <?php foreach ($photos as $photo) { ?> <div style="float:left;margin-left: 20px; display:inline;"> <a href="photo.php?id=<?php echo $photo->id; ?> "> <img src="<?php echo $photo->image_path();
<?php require_once '../includes/includes_all.php'; $cat = !empty($_GET['cat']) ? (int) $_GET['cat'] : 1; $qry = "select * from tblimages where cat_id={$cat}"; $photos = Photograph::find_by_sql($qry); ?> <html> <head> <link rel="stylesheet" type="text/css" href="stylesheets/style.css"/> <title>Wallpaper Hub</title> </head> <body> <div id="main"> <?php include_layout_template('header.php'); ?> <?php include_layout_template('menu.php'); ?> <div id="contents" > <div style="width:99%; padding:5px;" > <?php if ($session->is_logged_in()) { ?> <?php foreach ($photos as $photo) { ?> <a href="<?php echo $photo->image_path(); ?>
<?php $database = new MySQLDatabase(); $session = new Session(); $photo_details = Photograph::find_by_sql("SELECT * FROM photographs WHERE applicant_id=" . $session->applicant_id); foreach ($photo_details as $photo_detail) { $photo_detail->image_id; $photo_detail->applicant_id; $photo_detail->filename; $photo_detail->type; $photo_detail->size; $photo_detail->caption; } ?> <form action="" method="POST" id="passportupload" > <?php if ($photo_detail->applicant_id == $session->applicant_id) { ?> <table align="center"> <tr><td align="center"> <span style="color: #09F; font-weight: bold; text-shadow: 1px 1px 4px #F89406"><i class="iconic-user"></i> <?php echo $photo_detail->caption; ?> </span> </td></tr> <tr><td> </td></tr> <tr> <td> <div class="control-group">