Jump to content

sarah_uk

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sarah_uk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you everyone for replying! sorry i really dont understand much of what you posted though lol yes i do have a link with the following code in the "Properties" part: "products.php?TypeID=<?php echo $row_rsProductTypes['TypeID']; ?>" the link name has a "repeat region" so it shows up with all the names of the products and when you click on one of them each seperate link ends in a different "?TypeID=1/2/3/4/5" number. Here is my code for the main bit [code] "<?php require_once('Connections/fitnessdatabase.php'); ?> <?php $currentPage = $_SERVER["PHP_SELF"]; $maxRows_rsProducts = 4; $pageNum_rsProducts = 0; if (isset($_GET['pageNum_rsProducts'])) {   $pageNum_rsProducts = $_GET['pageNum_rsProducts']; } $startRow_rsProducts = $pageNum_rsProducts * $maxRows_rsProducts; $colname_rsProducts = "-1"; if (isset($_GET['1'])) {   $colname_rsProducts = (get_magic_quotes_gpc()) ? $_GET['1'] : addslashes($_GET['1']); } mysql_select_db($database_fitnessdatabase, $fitnessdatabase); $query_rsProducts = sprintf("SELECT ProductID, ProductName, Price, Description, Image FROM products WHERE TypeID = 1 ORDER BY ProductName ASC", $colname_rsProducts); $query_limit_rsProducts = sprintf("%s LIMIT %d, %d", $query_rsProducts, $startRow_rsProducts, $maxRows_rsProducts); $rsProducts = mysql_query($query_limit_rsProducts, $fitnessdatabase) or die(mysql_error()); $row_rsProducts = mysql_fetch_assoc($rsProducts); if (isset($_GET['totalRows_rsProducts'])) {   $totalRows_rsProducts = $_GET['totalRows_rsProducts']; } else {   $all_rsProducts = mysql_query($query_rsProducts);   $totalRows_rsProducts = mysql_num_rows($all_rsProducts); } $totalPages_rsProducts = ceil($totalRows_rsProducts/$maxRows_rsProducts)-1; mysql_select_db($database_fitnessdatabase, $fitnessdatabase); $query_rsProductTypes = "SELECT TypeID, TypeName FROM producttypes WHERE Online = 1 ORDER BY TypeName ASC"; $rsProductTypes = mysql_query($query_rsProductTypes, $fitnessdatabase) or die(mysql_error()); $row_rsProductTypes = mysql_fetch_assoc($rsProductTypes); $totalRows_rsProductTypes = mysql_num_rows($rsProductTypes); $queryString_rsProducts = ""; if (!empty($_SERVER['QUERY_STRING'])) {   $params = explode("&", $_SERVER['QUERY_STRING']);   $newParams = array();   foreach ($params as $param) {     if (stristr($param, "pageNum_rsProducts") == false &&         stristr($param, "totalRows_rsProducts") == false) {       array_push($newParams, $param);     }   }   if (count($newParams) != 0) {     $queryString_rsProducts = "&" . htmlentities(implode("&", $newParams));   } } $queryString_rsProducts = sprintf("&totalRows_rsProducts=%d%s", $totalRows_rsProducts, $queryString_rsProducts); ?>"[/code] I hope you understand what i mean? please help! if you want anything else just ask. Sarah
  2. Hello! Ok, first off i am a total noob at PHP i am making a website for part of my presentation and i have got stuck! Right what a want is to filter my product types from my database using the URL parameter in Dreamweaver. I have got my links all working (ending with "TypeID=1/2/3/4 etc") and database sorted, i just need to know how to filter them so it only shows up the products with an ID of 1 or 2 or 3 etc depending on the link. If you need any more information let me know, i am using phpMyAdmin and Dreamweaver to create the site. Plleeaaassee help someone! Sarah
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.