Posted by aaa Mon 26th Feb 2007 22:11 - Syntax is PHP - 46 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
PHP parser reported no syntax errors in this post!
Description:
hm..
hm..
-
/* sort user interface */
-
-
-
/* query MySQL */
-
$query = $_class['mysql']->cf_query(
-
$_db['database'],
-
"",
-
"select
-
`id`,
-
`overview`,
-
`title`,
-
`rate`,
-
`genre`,
-
`seen`
-
from
-
`log`
-
order by
-
'".$_class['mysql']->cf_safe($_sort)."'
-
".$_sortdir."
-
limit
-
".(($_pagenr-1)*100).",100
-
");
-
} else {
-
-
$query = $_class['mysql']->cf_query(
-
$_db['database'],
-
"",
-
"select
-
`id`,
-
`overview`,
-
`title`,
-
`rate`,
-
`genre`,
-
`seen`
-
from
-
`log`
-
where
-
`title`
-
like
-
'%".$_class['mysql']->cf_safe($_search)."%'
-
order by
-
'".$_class['mysql']->cf_safe($_sort)."'
-
".($_sort == "id"?"desc":"")."
-
limit
-
".(($_pagenr-1)*100).",100
-
");
-
}
-
-
-
class="main">
class="top">class="black" href="?sort=title">Movie "width:100px;" class="top">class="black" href="?sort=rate">Dice rate "width:100px;" class="top">class="black" href="?sort=genre">Genre "width:180px;" class="top">class="black" href="?sort=seen">Seen
PermaLink to this entry https://pastebin.co.uk/11032
Posted by aaa Mon 26th Feb 2007 22:11 - Syntax is PHP - 46 views
Download | New Post | Modify | Hide line numbers
Comments: 1
class Stupidsortproblem{
public $sortBy;
public $sortDir;
public $limit;
public $query;
public $debug = false;
public $thArray = array('Movie Title' => 'title',
'Dice Rate' => 'rate',
'Genre' => 'genre',
'Seen' => 'seen');
function __construct(){
$this->pull_GET_Vars();
$this->craft_Query();
$this->result = mysql_query($this->query);
if($this->debug === true){
if(!$this->result){ print $this->query; }
}
$this->display_Results();
}
function pull_GET_Vars(){
$this->sortBy = (isset($_GET['sort']) &&
!empty($_GET['sort'])) ? $_GET['sort'] : false;
$this->sortDir = (isset($_GET['sortdir'])&&
!empty($_GET['sortdir'])) ? $_GET['sortdir'] : 'asc';
$this->limit = (isset($_GET['limit'] &&
is_numeric($_GET['limit'])) ? $_GET['limit'] : 100;
}
function craft_Query(){
$this->query = "SELECT
id,
overview,
title,
rate,
genre,
seen
FROM
log
";
if($this->sortBy !== false){
$this->query .= "
ORDER by {$this->sort}
{$this->sortDir}
";
}
$this->query .= " LIMIT {$this->limit} ";
}
function display_Resutls(){
$displayDir = ($this->sortDir == 'asc') ? 'desc' : 'asc';
$html = '
';
foreach($this->thArray as $displayName => $columnName){
$fontWeight = ($columnName == $this->sortBy) ? 'bold' :
'normal';
$html .= '';
$html .= '
'.$displayName.'
';
}
while($obj = mysql_fetch_object($this->result)){
$html .= '
'.$obj->title.'
'.$obj->rate.'
'.$obj->genre.'
'.$obj->seen.'
';
}
$html .= ''
return print($html);
}
}