Hellow evey body,
I have to use same sql query frequently on diferenet php scripts pages in a appliction, i want to put this query in a funtion to use it where i want but this funtion is not working at all. i am unable to figure out the problem, the code is as follow,
function PhotoListQuery ($user, $album, $imViewAuth){
{
$sql = "SELECT a.im_id, a.im_title, a.im_thumbnail, a.im_album_id,
a.im_view_auth, DATE_FORMAT(a.im_date, '%d-%m- %Y') AS im_date, b.al_id, b.user_id
FROM " . image . " a, " . album ." b
WHERE b.user_id = $user AND a.im_album_id = b.al_id AND
(a.im_view_auth = 'Show to every body' OR
a.im_view_auth = '$imViewAuth')";
if ($album != '') {
$sql .= "AND a.im_album_id = $album ";
}
$sql .= "ORDER BY a.im_title ";
}
return $sql;
}
please help....
thanks in advance