Hi guys, recently had a previous post but nether seemed to crack the problem.
If it helps take a look at my previous thread http://www.sitepoint.com/forums/showthread.php?t=506441
Ok, I'm taking photographs 4 nights a week at different events and venues, previously I was just shooting 1 event or 1 venue a night, so I had no problem when I needed to call 1 date to show the photos from my 'table'. But now I'm shooting 3 - 4 venues&events in the one night, so I can no longer use my PK (date)from the 'photos table'.
So my tables, which will soon get updated to reflect the venue, event and so on.. but this is what I have now:
gallery details
some_id PK
venue_id
event_id
date
photos
photo_id PK
event_id
venue_id
date
views
gallery_details belongs to gallery1.php which has this snippet which links to gallery2.php and only selects the variables that are present from 'galley_details', because event_id and venue_id can some times be NULL:
PHP Code:
require_once('includes/mysql_connect.inc.php');
$query = "SELECT event_id, venue_id, DATE_FORMAT(date, '%d/%m/%y') AS dr2, date FROM gallery_details ORDER BY date DESC";
$res = mysql_query($query);
while ($row1 = mysql_fetch_assoc($res)) {
// Build the link even with null values.
$link = 'gallery2/' . $row1['event_id'] . '/' . $row1['venue_id'] . '/' . $row1['date'];
// Clean up the link strip out excess forward slashes (//, ////).
$link = preg_replace('~/{2,}~', '/', $link);
// If both event_id and venue_id are not empty then add @ between them.
if (!empty($row1['event_id']) && !empty($row1['venue_id'])) {
$text = $row1['event_id'] . '@' . $row1['venue_id'];
} else {
$text = $row1['event_id'] . $row1['venue_id'];
}
// How should it look when we output. %s = string data, Three postions total.
$form = '%s - <a href="%s">%s</a><br>';
// Take the format above and process it using the below function inserting
// the data of our chocie in the postion of our choice.
printf($form, $row1['dr2'], $link, $text);
}
'photos' which belongs to gallery2.php which i want to show the photos from that $date and $event and $venue from gallery1.php what ever it sends over..
Which says - Not Found
The requested URL /gallery2/event/venue/2007-09-29 was not found on this server.
PHP Code:
$sql = "SELECT photo_id, event_id, venue_id, DATE_FORMAT(date, '%d%m%y') AS subdir, views, caption FROM photos
WHERE venue_id = $venue_id AND event_id = event_id AND date= $date";
$result = @mysql_query($sql) or die('Error: ' . mysql_error());
for ($i = 0; $row = mysql_fetch_array ($result); $i++) {
if(($i != 0) and (($i % 8) == 0))
echo'<p></p>';
echo '<a href="photo/' . $row['photo_id'] . '" class="thumb"><img src="thumbs/' . $row['subdir'] . '/'. $row['photo_id'] . '.jpg" title="Views: ' . $row['views'] . '"></a>';
}
How can I adjust the above to show the url. ../event/venue/date?
PLEASE HELP! I'm out again all this weekend and need to get this sorted, BIG THANKS!
Any question please ask.
Bookmarks