nookyalur
%Europe/Berlin %822 %2007, 19:43
Hallo,
SITUATIESCHETS:
via een eigen CMS kan ik foto's uploaden naar de map 'riders' op mijn server. Bij het uploaden van de foto's, wordt ook een rider aan toegekend (gekozen uit een dropdownmenu). Dit lukt allemaal perfect.
Nu heb ik een pagina riders.php waar ik alle mensen uit de databank haal. Elke rider heeft een eigen gallery (riderspics.php). Deze pagina heeft bovenaan de naam van de rider, een grote foto en onderaan de kleine thumbs. Bij het klikken op de thumbs, moet de grote foto erboven staan. Dit lukt ook nog.
PROBLEMEN:
1. Niet alle foto's worden weergegeven als thumb. De laatste foto die geupload is onder de desbetreffende rider, wordt niet weergegeven. Zodra ik nog een nieuwe foto upload, dan is de vorige foto wel te zien als thumb.
2. Als ik op de riderspics.php kom, moet ik standaard al de laatste foto in het groot zien op ijn scherm. Nu vindt hij de foto niet. Als ik op de thumbs klik, dan werkt het wel...
DATABASE:
id = int
rider = varchar (vb 'test')
foto = varchar (vb '10.jpg')
RIDERS.PHP:
<?php require_once('Connections/conn.php'); ?>
<?php
mysql_select_db($database_conn, $conn);
$query_rs_riders = sprintf("SELECT * FROM riders ORDER BY rider ASC");
$rs_riders = mysql_query($query_rs_riders, $conn) or die(mysql_error());
$row_rs_riders = mysql_fetch_assoc($rs_riders);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="news_stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
body{
scrollbar-track-color:#000000;
scrollbar-3d-light:#000000;
scrollbar-arrow-color:#000000;
scrollbar-base-color:#000000;
scrollbar-darkshadow-color:#000000;
scrollbar-face-color:#fddb03;
scrollbar-highlight-color:#000000;
scrollbar-shadow-color:#000000;
}
</style>
</head>
<body bgcolor="#000000" class="normaal">
Please choose the rider-album from the list below:
<br>
<br>
<?php do { ?>
<a href="riderspics.php?rider=<?php echo $row_rs_riders['rider']; ?>"><?php echo $row_rs_riders['rider']; ?></a><br>
<?php } while ($row_rs_riders = mysql_fetch_assoc($rs_riders)); ?>
</body>
</html>
<?php
mysql_free_result($rs_riders);
?>
RIDERSPICS.php
<?php require_once('Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rs_riderspics = "-1";
if (isset($_GET['rider'])) {
$colname_rs_riderspics = $_GET['rider'];
}
mysql_select_db($database_conn, $conn);
$query_rs_riderspics = sprintf("SELECT * FROM riderspics WHERE rider = %s ORDER BY id DESC", GetSQLValueString($colname_rs_riderspics, "text"));
$rs_riderspics = mysql_query($query_rs_riderspics, $conn) or die(mysql_error());
$row_rs_riderspics = mysql_fetch_assoc($rs_riderspics);
$totalRows_rs_riderspics = mysql_num_rows($rs_riderspics);
$colname_rs_picture = "-1";
if (isset($_GET['rider'])) {
$colname_rs_picture = $_GET['rider'];
}
$colname2_rs_picture = "-1";
if (isset($_GET['id'])) {
$colname2_rs_picture = $_GET['id'];
}
mysql_select_db($database_conn, $conn);
$query_rs_picture = sprintf("SELECT * FROM riderspics WHERE rider = %s AND id = %s ORDER BY foto DESC", GetSQLValueString($colname_rs_picture, "text"),GetSQLValueString($colname2_rs_picture, "int"));
$rs_picture = mysql_query($query_rs_picture, $conn) or die(mysql_error());
$row_rs_picture = mysql_fetch_assoc($rs_picture);
$totalRows_rs_picture = mysql_num_rows($rs_picture);
?>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="news_stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
body{
scrollbar-track-color:#000000;
scrollbar-3d-light:#000000;
scrollbar-arrow-color:#000000;
scrollbar-base-color:#000000;
scrollbar-darkshadow-color:#000000;
scrollbar-face-color:#fddb03;
scrollbar-highlight-color:#000000;
scrollbar-shadow-color:#000000;
}
</style>
</head>
<body bgcolor="#000000">
<table width="100%" height="100%" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td class="normaal" align="center"><?php echo strtoupper($row_rs_riderspics['rider']); ?> - <a href="riders.php">Back to the riders</a><br> </td>
<td width="20" rowspan="5"></td>
<td></td>
</tr>
</tr>
<tr><td class="normaal" align="center"><p><img src="<?php echo $row_rs_picture['foto']; ?>" height="450px"></p>
</td>
<td></td>
</tr>
<tr>
<td align="center"><br>
<p>
<?php
$i = 0;
echo '<table>
<tr>';
while ($row_rs_riderspics = mysql_fetch_array($rs_riderspics)){
if( $i%5 == 0 && $i > 0 ) {
echo '</tr><tr>';
}
echo "<td><a href='riderspics.php?rider=" .$row_rs_riderspics['rider']. "&id=" .$row_rs_riderspics['id']. "'><img height='80' src=\"riders/" .$row_rs_riderspics['foto']. "\"/></a><br /></span><td width='5'></td>";
$i++;
}
echo '</tr></table>';
?>
</p> </td>
</tr>
<tr><td class="normaal"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rs_riderspics);
mysql_free_result($rs_picture);
?>
SITUATIESCHETS:
via een eigen CMS kan ik foto's uploaden naar de map 'riders' op mijn server. Bij het uploaden van de foto's, wordt ook een rider aan toegekend (gekozen uit een dropdownmenu). Dit lukt allemaal perfect.
Nu heb ik een pagina riders.php waar ik alle mensen uit de databank haal. Elke rider heeft een eigen gallery (riderspics.php). Deze pagina heeft bovenaan de naam van de rider, een grote foto en onderaan de kleine thumbs. Bij het klikken op de thumbs, moet de grote foto erboven staan. Dit lukt ook nog.
PROBLEMEN:
1. Niet alle foto's worden weergegeven als thumb. De laatste foto die geupload is onder de desbetreffende rider, wordt niet weergegeven. Zodra ik nog een nieuwe foto upload, dan is de vorige foto wel te zien als thumb.
2. Als ik op de riderspics.php kom, moet ik standaard al de laatste foto in het groot zien op ijn scherm. Nu vindt hij de foto niet. Als ik op de thumbs klik, dan werkt het wel...
DATABASE:
id = int
rider = varchar (vb 'test')
foto = varchar (vb '10.jpg')
RIDERS.PHP:
<?php require_once('Connections/conn.php'); ?>
<?php
mysql_select_db($database_conn, $conn);
$query_rs_riders = sprintf("SELECT * FROM riders ORDER BY rider ASC");
$rs_riders = mysql_query($query_rs_riders, $conn) or die(mysql_error());
$row_rs_riders = mysql_fetch_assoc($rs_riders);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="news_stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
body{
scrollbar-track-color:#000000;
scrollbar-3d-light:#000000;
scrollbar-arrow-color:#000000;
scrollbar-base-color:#000000;
scrollbar-darkshadow-color:#000000;
scrollbar-face-color:#fddb03;
scrollbar-highlight-color:#000000;
scrollbar-shadow-color:#000000;
}
</style>
</head>
<body bgcolor="#000000" class="normaal">
Please choose the rider-album from the list below:
<br>
<br>
<?php do { ?>
<a href="riderspics.php?rider=<?php echo $row_rs_riders['rider']; ?>"><?php echo $row_rs_riders['rider']; ?></a><br>
<?php } while ($row_rs_riders = mysql_fetch_assoc($rs_riders)); ?>
</body>
</html>
<?php
mysql_free_result($rs_riders);
?>
RIDERSPICS.php
<?php require_once('Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rs_riderspics = "-1";
if (isset($_GET['rider'])) {
$colname_rs_riderspics = $_GET['rider'];
}
mysql_select_db($database_conn, $conn);
$query_rs_riderspics = sprintf("SELECT * FROM riderspics WHERE rider = %s ORDER BY id DESC", GetSQLValueString($colname_rs_riderspics, "text"));
$rs_riderspics = mysql_query($query_rs_riderspics, $conn) or die(mysql_error());
$row_rs_riderspics = mysql_fetch_assoc($rs_riderspics);
$totalRows_rs_riderspics = mysql_num_rows($rs_riderspics);
$colname_rs_picture = "-1";
if (isset($_GET['rider'])) {
$colname_rs_picture = $_GET['rider'];
}
$colname2_rs_picture = "-1";
if (isset($_GET['id'])) {
$colname2_rs_picture = $_GET['id'];
}
mysql_select_db($database_conn, $conn);
$query_rs_picture = sprintf("SELECT * FROM riderspics WHERE rider = %s AND id = %s ORDER BY foto DESC", GetSQLValueString($colname_rs_picture, "text"),GetSQLValueString($colname2_rs_picture, "int"));
$rs_picture = mysql_query($query_rs_picture, $conn) or die(mysql_error());
$row_rs_picture = mysql_fetch_assoc($rs_picture);
$totalRows_rs_picture = mysql_num_rows($rs_picture);
?>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="news_stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
body{
scrollbar-track-color:#000000;
scrollbar-3d-light:#000000;
scrollbar-arrow-color:#000000;
scrollbar-base-color:#000000;
scrollbar-darkshadow-color:#000000;
scrollbar-face-color:#fddb03;
scrollbar-highlight-color:#000000;
scrollbar-shadow-color:#000000;
}
</style>
</head>
<body bgcolor="#000000">
<table width="100%" height="100%" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td class="normaal" align="center"><?php echo strtoupper($row_rs_riderspics['rider']); ?> - <a href="riders.php">Back to the riders</a><br> </td>
<td width="20" rowspan="5"></td>
<td></td>
</tr>
</tr>
<tr><td class="normaal" align="center"><p><img src="<?php echo $row_rs_picture['foto']; ?>" height="450px"></p>
</td>
<td></td>
</tr>
<tr>
<td align="center"><br>
<p>
<?php
$i = 0;
echo '<table>
<tr>';
while ($row_rs_riderspics = mysql_fetch_array($rs_riderspics)){
if( $i%5 == 0 && $i > 0 ) {
echo '</tr><tr>';
}
echo "<td><a href='riderspics.php?rider=" .$row_rs_riderspics['rider']. "&id=" .$row_rs_riderspics['id']. "'><img height='80' src=\"riders/" .$row_rs_riderspics['foto']. "\"/></a><br /></span><td width='5'></td>";
$i++;
}
echo '</tr></table>';
?>
</p> </td>
</tr>
<tr><td class="normaal"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rs_riderspics);
mysql_free_result($rs_picture);
?>