carlfaulkner Posted August 20, 2011 Share Posted August 20, 2011 can anyone solve this. i am trying to add pages to the following code but i cant get my head around it what so ever. Can anyone help <?php include_once('inc_dbcon.php'); require_once('admin/config.php');require_once($languageFile);// Preview descrition length in characters$previewLength = 240;// check to see if in admin mode and validate keyglobal $keyOut;$keyOut = "";if (isset($_GET["k"])) if($_GET["k"] == $key){ // Key comes from admin/password.php file $keyOut = "&k=" . $key; } global $category;$category = "%";if (isset($_GET["category"])) $category = mysql_real_escape_string($_GET["category"]);$msg = "";if (isset($_GET["msg"])) $msg = mysql_real_escape_string($_GET["msg"]);// SEARCH CODE START$searchQuery = "";if (isset($_GET["q"])) $searchQuery = mysql_real_escape_string($_GET["q"]);if ($searchQuery != "") { $query_Recordset1 = "SELECT postId,category,title,description,isAvailable,description,price,confirmPassword,category,imgURL,imgURLThumb,DATE_FORMAT(timeStamp,'%b %d, %Y %l:%i %p') AS timeStamp1 FROM md_postings WHERE isConfirmed = '1' AND title like '%$searchQuery%' OR description like '%searchQuery%' ORDER BY `timeStamp` DESC";} else { // this following line was pulled from about ten lines below if you are updating an older version $query_Recordset1 = "SELECT postId,category,title,description,isAvailable,description,price,confirmPassword,category,imgURL,imgURLThumb,DATE_FORMAT(timeStamp,'%b %d, %Y %l:%i %p') AS timeStamp1 FROM md_postings WHERE isConfirmed = '1' AND category like '$category' ORDER BY `timeStamp` DESC";}// SEARCH CODE END - see also line 113 below$maxRows_Recordset1 = 100;$pageNum_Recordset1 = 0;if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = mysql_real_escape_string($_GET['pageNum_Recordset1']);}$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);$Recordset1 = mysql_query($query_limit_Recordset1); if (!$Recordset1){ print("It appears we have a problem: " . mysql_error()); exit(); }$row_Recordset1 = mysql_fetch_assoc($Recordset1);if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = mysql_real_escape_string($_GET['totalRows_Recordset1']);} else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);}$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;$queryString_Recordset1 = "";if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); }}$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link href="md_style.css" rel="stylesheet" type="text/css" /><script language="JavaScript">function doFilter(dis){ window.location.href = "index.php?category=<?php echo $category ?>&type=" + dis.value + "<?php echo $keyOut;?>"} </script></head><body><div id="md_container"><?php include_once("inc_header.php") ;?><?php include_once("inc_navigation.php") ;?><?php if ($msg == "deleted") print("<br clear='all' /> <div class='md_msg' style='margin-top:-10px;'>" . STR_DELETED ."</div>"); ?><br clear="all" /> <div id='md_listingBox'><?phpif($totalRows_Recordset1 < 1){ // SEARCH START new Code - added IF statement to support search if ($searchQuery != "") echo "<p><br /><br /><br />" . STR_NORESULTS . "<b>" . $searchQuery ."</b></p>"; else echo "<p><br /><br /><br />" . STR_NOITEMS . "</p>"; // SEARCH END NEW CODE} else { do { $img = "/images/gift_light.gif' title='This is a gift!'"; $type = $row_Recordset1['type']; $isAvailable = $row_Recordset1['isAvailable']; $isAvailableClass = ($isAvailable == 0) ? 'md_taken' : ''; $thumbnail = ' '; if (strlen($row_Recordset1['imgURLThumb']) > 3){ $thumbnail = "<a href='viewItem.php?id=" . $row_Recordset1['postId'] . "' class='md_recordLink " . $isAvailableClass . "'>"; $thumbnail .= "<img src='" . $row_Recordset1['imgURLThumb'] . "' class='md_thumbnail' border='0'></a>"; } else{ $thumbnail = "<b>No Image Available</b>"; }?><table width="100%" border="0" cellpadding="4" class="md_listingTable"> <tr> <td width="84" height="74" align="center"><?php echo $thumbnail; ?></td> <td valign="top"> <div class='md_date'><?php echo $row_Recordset1['timeStamp1'];?></div> <a href="viewItem.php?id=<?php echo $row_Recordset1['postId'] . $keyOut;?>" class='md_recordLink<?php echo $isAvailableClass; ?>'><?php echo stripslashes($row_Recordset1['title']); ?></a> — £<?php echo $row_Recordset1['price']; ?> <br /> <?php echo stripslashes(substr($row_Recordset1['description'],0,$previewLength)); ?>... </td> </tr></table><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); } // end else clause?> </div><?php include_once("inc_footer.php");?></div></body></html><?php mysql_close($dbConn); ?> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 21, 2011 Share Posted August 21, 2011 What problem are you trying to solve? What is the code doing that's not correct? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.