当前位置: 首页>>代码示例>>PHP>>正文


PHP Photograph::find_by_sql方法代码示例

本文整理汇总了PHP中Photograph::find_by_sql方法的典型用法代码示例。如果您正苦于以下问题:PHP Photograph::find_by_sql方法的具体用法?PHP Photograph::find_by_sql怎么用?PHP Photograph::find_by_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photograph的用法示例。


在下文中一共展示了Photograph::find_by_sql方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLikes

function getLikes($picID)
{
    $sqlQuery = "SELECT photograph_id FROM votes ";
    $sqlQuery .= "WHERE photograph_id ={$picID}";
    $photographsQuery = Photograph::find_by_sql($sqlQuery);
    echo sizeof($photographsQuery);
}
开发者ID:dylan18595,项目名称:Picter,代码行数:7,代码来源:getLikes.php

示例2: Pagination

// 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;
    ?>
开发者ID:raynaldmo,项目名称:php-education,代码行数:31,代码来源:index.php

示例3: include_layout_template

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();
开发者ID:ciplpj,项目名称:photo_gallery,代码行数:30,代码来源:index.php

示例4: foreach

<?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();
        ?>
开发者ID:saurabh8410,项目名称:Php,代码行数:31,代码来源:images.php

示例5: MySQLDatabase

<?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>&nbsp;</td></tr>
	<tr>
		<td>
			<div class="control-group">
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:passport.php


注:本文中的Photograph::find_by_sql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。