|
Posted by ameshkin on 11/18/43 11:43
I'm having all kinds of visual problems using dreamweaver's built in
query builder. I have 4 different categories. Right.
I want to show ten records from each category of items in a mysql
database. All on the same page. Could someone tell me what is wrong
with my code?
The page is here
http://www.picmonkey.com/MoreGraphics.php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_ForBoys = 10;
$pageNum_ForBoys = 0;
if (isset($_GET['pageNum_ForBoys'])) {
$pageNum_ForBoys = $_GET['pageNum_ForBoys'];
}
$startRow_ForBoys = $pageNum_ForBoys * $maxRows_ForBoys;
mysql_select_db($database_piggybank, $piggybank);
$query_ForBoys = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics
where `cat` = 'For Guys'";
$ForBoys = mysql_query($query_ForBoys, $piggybank) or
die(mysql_error());
$row_ForBoys = mysql_fetch_assoc($ForBoys);
$totalRows_ForBoys = mysql_num_rows($ForBoys);
if (isset($_GET['totalRows_ForBoys'])) {
$totalRows_ForBoys = $_GET['totalRows_ForBoys'];
} else {
$all_ForBoys = mysql_query($query_ForBoys);
$totalRows_ForBoys = mysql_num_rows($all_ForBoys);
}
$totalPages_ForBoys = ceil($totalRows_ForBoys/$maxRows_ForBoys)-1;
//2
$maxRows_ForGirls = 10;
$pageNum_ForGirls = 0;
if (isset($_GET['pageNum_ForGirls'])) {
$pageNum_ForGirls = $_GET['pageNum_ForGirls'];
}
$startRow_ForGirls = $pageNum_ForGirls * $maxRows_ForGirls;
mysql_select_db($database_piggybank, $piggybank);
$query_ForGirls = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics where
`cat` = 'For Girls'";
$query_limit_ForGirls = sprintf("%s LIMIT %d, %d", $query_ForGirls,
$startRow_ForGirls, $maxRows_ForGirls);
$ForGirls = mysql_query($query_limit_ForGirls, $piggybank) or
die(mysql_error());
$row_ForGirls = mysql_fetch_assoc($ForGirls);
if (isset($_GET['totalRows_ForGirls'])) {
$totalRows_ForGirls = $_GET['totalRows_ForGirls'];
} else {
$all_ForGirls = mysql_query($query_ForGirls);
$totalRows_ForGirls = mysql_num_rows($all_ForGirls);
}
$totalPages_ForGirls = ceil($totalRows_ForGirls/$maxRows_ForGirls)-1;
mysql_select_db($database_piggybank, $piggybank);
$query_Animals = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics WHERE
`cat` = 'Animals'";
$Animals = mysql_query($query_Animals, $piggybank) or
die(mysql_error());
$row_Animals = mysql_fetch_assoc($Animals);
$totalRows_Animals = mysql_num_rows($Animals);
mysql_select_db($database_piggybank, $piggybank);
$query_Cartoons = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics WHERE
`cat` = 'Cartoons'";
$Cartoons = mysql_query($query_Cartoons, $piggybank) or
die(mysql_error());
$row_Cartoons = mysql_fetch_assoc($Cartoons);
$totalRows_Cartoons = mysql_num_rows($Cartoons);
$queryString_ForGirls = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_ForGirls") == false &&
stristr($param, "totalRows_ForGirls") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_ForGirls = "&" . htmlentities(implode("&",
$newParams));
}
}
$queryString_ForGirls = sprintf("&totalRows_ForGirls=%d%s",
$totalRows_ForGirls, $queryString_ForGirls);
//column 3
$maxRows_Glitter = 10;
$pageNum_Glitter = 0;
if (isset($_GET['pageNum_Glitter'])) {
$pageNum_Glitter = $_GET['pageNum_Glitter'];
}
$startRow_Glitter = $pageNum_Glitter * $maxRows_Glitter;
mysql_select_db($database_piggybank, $piggybank);
$query_Glitter = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics
where `cat` = 'Glitter'";
$Glitter = mysql_query($query_Glitter, $piggybank) or
die(mysql_error());
$row_Glitter = mysql_fetch_assoc($Glitter);
$totalRows_Glitter = mysql_num_rows($Glitter);
if (isset($_GET['totalRows_Glitter'])) {
$totalRows_Glitter = $_GET['totalRows_Glitter'];
} else {
$all_Glitter = mysql_query($query_Glitter);
$totalRows_Glitter = mysql_num_rows($all_Glitter);
}
$totalPages_Glitter = ceil($totalRows_Glitter/$maxRows_Glitter)-1;
?>
<?php
$maxRows_Animals = 10;
$pageNum_Animals = 0;
if (isset($_GET['pageNum_Animals'])) {
$pageNum_Animals = $_GET['pageNum_Animals'];
}
$startRow_Animals = $pageNum_Animals * $maxRows_Animals;
mysql_select_db($database_piggybank, $piggybank);
$query_Animals = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics where
`cat` = 'For Girls'";
$query_limit_Animals = sprintf("%s LIMIT %d, %d", $query_Animals,
$startRow_Animals, $maxRows_Animals);
$Animals = mysql_query($query_limit_Animals, $piggybank) or
die(mysql_error());
$row_Animals = mysql_fetch_assoc($Animals);
if (isset($_GET['totalRows_Animals'])) {
$totalRows_Animals = $_GET['totalRows_Animals'];
} else {
$all_Animals = mysql_query($query_Animals);
$totalRows_Animals = mysql_num_rows($all_Animals);
}
$totalPages_Animals = ceil($totalRows_Animals/$maxRows_Animals)-1;
mysql_select_db($database_piggybank, $piggybank);
$query_Glitter = "SELECT graphics.owner, graphics.UploadDate,
graphics.cat, graphics.location, graphics.auto FROM graphics WHERE
`cat` = 'Glitter'";
$Glitter = mysql_query($query_Glitter, $piggybank) or
die(mysql_error());
$row_Glitter = mysql_fetch_assoc($Glitter);
$totalRows_Glitter = mysql_num_rows($Glitter);
?>
<?php include('header.php'); ?>
<td colspan="3"><h1><a href="index.php">Index</a> - Browse
Graphics</h1></td></table>
<div class="dotted" id="Layer1" style="position:absolute; width:383px;
height:153px; z-index:1; left: 470px; top: 112px; background-color:
#e4e9eb; layer-background-color: #e4e9eb;">
<script language="JavaScript" type="text/javascript">
<!--
ctxt_ad_partner = "1066315875";
ctxt_ad_section = "29578";
ctxt_ad_bg = "";
ctxt_ad_width = 336;
ctxt_ad_height = 280;
ctxt_ad_bc = "e4e9eb";
ctxt_ad_cc = "e4e9eb";
ctxt_ad_lc = "543d25";
ctxt_ad_tc = "000000";
ctxt_ad_uc = "999999";
// -->
</script>
<script language="JavaScript"
src="http://ypn-js.overture.com/partner/js/ypn.js">
</script>
<br>
<a href="http://www.mytuneslive.com"
target="_blank">MyTunesLive.com<br>
</a><br>
Play your MP3 Library from anywhere! You can create a profile, and put
a flash player in your myspace, friendster or other social site!
</div>
<?php do { ?><?php do { ?><?php do { ?><?php do { ?>
<table width="950" border="0" align="center">
<tr>
<td width="100"><div align="center"> <a
href="http://www.picmonkey.com/MyCode.php?mine=<?php echo
$row_ForGirls['auto']; ?>"><img src="<?php echo
$row_ForGirls['location']; ?>" width="100" align="middle"
border="0"></a></div> </td>
<td width="100"><div align="center"> <a
href="http://www.picmonkey.com/MyCode.php?mine=<?php echo
$row_ForBoys['auto']; ?>"><img src="<?php echo
$row_ForBoys['location']; ?>" width="100" align="middle"
border="0"></div></td>
<td width="100"><div align="center"> <a
href="http://www.picmonkey.com/MyCode.php?mine=<?php echo
$row_Animals['auto']; ?>"><img src="<?php echo
$row_Animals['location']; ?>" width="100" align="middle"
border="0"></div></td>
<td width="387"></td>
<td colspan="2"><div align="center"> <a
href="http://www.picmonkey.com/MyCode.php?mine=<?php echo
$row_Glitter['auto']; ?>"><img src="<?php echo
$row_Glitter['location']; ?>" width="150" align="middle"
border="0"></div></td>
</tr>
<tr>
<td></td>
<td></td>
<td> </td>
<td> </td>
<td width="1"> </td>
<td width="236"> </td>
</tr>
</table>
<?php } while ($row_ForGirls = mysql_fetch_assoc($ForGirls)); ?>
<?php } while ($row_ForBoys = mysql_fetch_assoc($ForBoys)); ?>
<?php } while ($row_Animals = mysql_fetch_assoc($Animals)); ?>
<?php } while ($row_Glitter = mysql_fetch_assoc($Glitter)); ?>
<table width="950" border="0" align="center">
<tr>
<td width="100"><div align="right"><a href="<?php
printf("%s?pageNum_ForGirls=%d%s", $currentPage,
min($totalPages_ForGirls, $pageNum_ForGirls + 1),
$queryString_ForGirls); ?>">View More </a></div></td>
<td width="100"><div align="right"><a href="<?php
printf("%s?pageNum_ForBoys=%d%s", $currentPage,
min($totalPages_ForBoys, $pageNum_ForBoys + 1), $queryString_ForBoys);
?>">View More</a></div></td>
<td width="185"> </td>
<td width="133"> </td>
<td width="240"><div align="right"><a href="<?php
printf("%s?pageNum_Glitter=%d%s", $currentPage,
min($totalPages_Glitter, $pageNum_Glitter + 1), $queryString_Glitter);
?>">View More</a></div></td>
</tr>
<tr>
<td width="100"> </td>
<td width="100"> </td>
<td width="185"> </td>
<td width="133"> </td>
<td width="240"> </td>
</tr>
</table>
Navigation:
[Reply to this message]
|