|
Posted by Rik on 10/17/21 11:46
ste wrote:
> Likewise, going to the url:
> mywebsite.com/gallery.php?imagetype=portrait
> it opens all the images from my database which are tagged with the
> category of portrait.
>
> Is there a way to open the gallery showing ALL pictures, without
> having to re-write the sql query? i.e. is there a tag I can enter in
> a URL which displays images where the imagetype could literally be
> anything? mywebsite.com/gallery.php?imagetype=anything
just don't set the imagetype, so the url would be mywebsite.com/gallery.php,
and use this code:
//create database $connection
if(get_magic_quotes_gpc()){
$_GET['imagetype'] = stripslashes($_GET['imagetype']);
}
$imagetype = mysql_real_escape_string( $_GET['imagetype'], $connection);
$where = (isset($_GET['imagetype'])) ? "WHERE imagetype =
'".$_GET['imagetype']."'" : '';
$query = "SELECT * FROM mydatabase ".$where;
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|