Re: Problems outputting to a 3 column table in order to crate an image gallery
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Problems outputting to a 3 column table in order to crate an image gallery

From: Rik <luiheidsgoeroe@hotmail.com>
Date: Sun Apr 30 2006 - 13:42:01 CEST

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
Received on Mon May 1 03:07:46 2006