Assuming that gAccessLevel = eather one of level-1, level-2, level-3 ...
if (!$gStart) { $gStart=0; }
$sql = "SELECT * FROM gallerys WHERE gMode = '$mode' AND ";
if ($siteAccessLevel == "level-1") {
// LEVEL-1 VIEWING ONLY.
$sql .= "WHERE (gAccessLevel = 'level-1')";
} else if ($siteAccessLevel == "level-2") {
// LEVEL-2 AND LEVEL-1 VIEWING ONLY.
$sql .= "WHERE (gAccessLevel = 'level-1' OR gAccessLevel = 'level-2')";
} else if ($siteAccessLevel == "level-3") {
// PAYING, ACCESS ALL IMAGES!
$sql .= "WHERE (gAccessLevel = 'level-1' OR gAccessLevel = 'level-2' OR
gAccessLevel = 'level-3')";
} else {
// IF ERROR SHOW LEVEL ONE.
$sql .= "WHERE (gAccessLevel = 'level-1')";
}
$sql .= " ORDER BY gId DESC LIMIT $gStart, 10";
echo $sql;
$sql_result = mysql_query($sql, $connection) or die (mysql_error());
MY ERROR MESSAGE IS ...
10You have an error in your SQL syntax near 'WHERE (gAccessLevel = 'level-1'
OR gAccessLevel = 'level-2' OR gAccessLevel = 'l' at line 1
as gAccessLevel = level-3 ...
Any Ideas why this is weong?
------
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]
+64 (9) 576 9491
+64 021-048-3999
------
Friends are like stars
You can't allways see them,
but they are always there.
------
Websites:
PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]
Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]
Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php