Skip to main content
Inspiring
September 19, 2012
Question

linking a recordset to multiple recordsets. REALLY need help

  • September 19, 2012
  • 1 reply
  • 739 views

this is a carry on from another thread.

i have catagories, products and each product has its sizes.

i have made the mysql DB with the following catagory

int(11)

No
auto_incrementBrowse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext

a products table

int(11)

No
auto_incrementBrowse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
textlatin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
float(6,2)

No0.00
Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext

and a sizes table

int(11)

No
auto_incrementBrowse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(80)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(80)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
No

Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(155)latin1_swedish_ci
YesNULL
Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(155)latin1_swedish_ci
YesNULL
Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(155)latin1_swedish_ci
YesNULL
Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext
varchar(200)latin1_swedish_ci
YesNULL
Browse distinct valuesChangeDropPrimaryUniqueIndexFulltext

theses are all working great in the backend

in the front end i have a product page that is displaying the product small image

<a href="product-description.php?ID=<?php echo $row_Recordset1['ID']; ?>"><img src="../images/AW/thumbs/<?php echo $row_Recordset1['imageSmall']; ?>"/></a>

and this has a repeat region to diplay all the product

in the product-description is where i am lost

i have to show

the catagory name and price that fine from recordset1

$colname_Recordset1 = "-1";

if (isset($_GET['ID'])) {

  $colname_Recordset1 = $_GET['ID'];

}

mysql_select_db($database_beau, $beau);

$query_Recordset1 = sprintf("SELECT * FROM beauProd, beauCat WHERE ID = %s AND beauProd.CatID = beauCat.catID", GetSQLValueString($colname_Recordset1, "int"));

$Recordset1 = mysql_query($query_Recordset1, $beau) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

<?php echo $row_Recordset1['catname']; ?>

<?php echo $row_Recordset1['price']; ?>

I NEED a select list showing all the products from that catagory and when another product is selected and submitted it goes to that new product I have done the following select list

          <form id="FormName" action="" method="get" name="FormName">

            <select id="selectName" name="name">

              <option value="Select Design">Select Design</option>

              <?php

do {

?>

              <option value="<?php echo $row_Recordset1['catID']; ?>"><?php echo $row_Recordset1['catname']; ?></option>

              <?php

} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

  $rows = mysql_num_rows($Recordset1);

  if($rows > 0) {

      mysql_data_seek($Recordset1, 0);

            $row_Recordset1 = mysql_fetch_assoc($Recordset1);

  }

?>

            </select>

            <input type="submit" name="button" id="button" value="select" />

          </form>

then i need the sizes from each product to be displayed. It currently is showing all product sizes.

i have made a new recordset2

mysql_select_db($database_beau, $beau);

$query_Recordset2 = "SELECT * FROM beauProd, beauSizes WHERE beauProd.SizeProdID = beauSizes.SizeProdID";

$Recordset2 = mysql_query($query_Recordset2, $beau) or die(mysql_error());

$row_Recordset2 = mysql_fetch_assoc($Recordset2);

$totalRows_Recordset2 = mysql_num_rows($Recordset2);

<select id="Cos0" name="os0">

    <option value="select Category">Select Size</option>

    <?php

do {

?>

    <option value="<?php echo $row_Recordset2['SizeID']; ?>"><?php echo $row_Recordset2['from'] . " . " . $row_Recordset2['to'] ; ?></option>

    <?php

} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));

  $rows = mysql_num_rows($Recordset1);

  if($rows > 0) {

      mysql_data_seek($Recordset2, 0);

            $row_Recordset2 = mysql_fetch_assoc($Recordset2);

  }

?>

    </select>

I am tottally lost now. can anyone help

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
September 19, 2012

i think its about the filtering of the information i have tried

$colname_Recordset2 = "-1";

if (isset($_GET['SizeProdID'])) {

  $colname_Recordset2 = $_GET['SizeProdID'];

}

mysql_select_db($database_beau, $beau);

$query_Recordset2 = sprintf("SELECT * FROM beauProd, beauSizes WHERE beauSizes.SizeProdID = beauProd.SizeProdID AND beauSizes.SizeProdID = %s", GetSQLValueString($colname_Recordset2, "int"));

$Recordset2 = mysql_query($query_Recordset2, $beau) or die(mysql_error());

$row_Recordset2 = mysql_fetch_assoc($Recordset2);

$totalRows_Recordset2 = mysql_num_rows($Recordset2);

i need to display just the information from each product and show the "to" and "from" in the select list on the sizes