best method to get sizes for a product from a php mysql db

my hosting company created it for me

then they need to give dbbox select option for that database

then they need to give dbbox select option for that database

they need to give what to dbbox select option, sorry?

sorted it and started from scratch

just joined all the table in one query and echoed out what i needed too…i was over complicating things

$query_rsProdList = sprintf("SELECT * FROM poochieProd, poochieCat, poochieSizes, poochieStock WHERE poochieProd.CatID = poochieCat.CatID AND poochieProd.ProdID = poochieStock.ProdID AND poochieSizes.SizeID = poochieStock.sizeID AND poochieProd.ProdID = %s ", GetSQLValueString($var1_rsProdList, “int”));

    <select name="os0" class="text" id="selectSize">
      <option value="Select Size">Select Size</option>
	  <?php do { ?>
      <option value="<?php echo $row_rsProdList['SizeID']; ?>"><?php echo $row_rsProdList['Size']; ?></option>
    <?php } while ($row_rsProdList = mysql_fetch_assoc($rsProdList)); ?></select>

thanks for everybodys help

WAIT…the thing i need to add though is if the stock = 0 dont display size or show a “sold out” next to the size

thanks in advance

show me your whole code where that is i will make you one

[php]$maxRows_rsProdList = 18;
$pageNum_rsProdList = 0;
if (isset($_GET[‘pageNum_rsProdList’])) {
$pageNum_rsProdList = $_GET[‘pageNum_rsProdList’];
}
$startRow_rsProdList = $pageNum_rsProdList * $maxRows_rsProdList;

$var1_rsProdList = “-1”;
if (isset($_GET[‘recordID’])) {
$var1_rsProdList = $_GET[‘recordID’];
}
mysql_select_db($database_poochie, $poochie);
$query_rsProdList = sprintf(“SELECT * FROM poochieProd, poochieCat, poochieSizes, poochieStock WHERE poochieProd.CatID = poochieCat.CatID AND poochieProd.ProdID = poochieStock.ProdID AND poochieSizes.SizeID = poochieStock.sizeID AND poochieProd.ProdID = %s “, GetSQLValueString($var1_rsProdList, “int”));
$query_limit_rsProdList = sprintf(”%s LIMIT %d, %d”, $query_rsProdList, $startRow_rsProdList, $maxRows_rsProdList);
$rsProdList = mysql_query($query_limit_rsProdList, $poochie) or die(mysql_error());
$row_rsProdList = mysql_fetch_assoc($rsProdList);[/php]

    [php]<select name="os0" class="text" id="selectSize">
      <option value="Select Size">Select Size</option>
	  <?php do { ?>
      <option value="<?php echo $row_rsProdList['SizeID']; ?>"><?php echo $row_rsProdList['Size']; ?></option>
    <?php } while ($row_rsProdList = mysql_fetch_assoc($rsProdList)); ?></select>[/php]

that its

thanks in advance

ok thats that code where is the code where it says sold out

that what i need to make

ok it doesnt say sold out or you want it to say sold out

if a product is sold out i want it to say sold out next to that size would it be like this?

<?php $sql = "SELECT sold FROM poochieStock"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $checked = $result['sold']; ?>

<input type=“checkbox” name=“sold” value=“1” <?php if ($checked == 1) echo 'sold'; ?> />

ok cause wen i read your post it said you didnt want it to say sold out so as you put it in your code

[php]

<?php $sql = "SELECT sold FROM poochieStock"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $checked = $result['sold']; ?>

<input type=“checkbox” name=“sold” value="<? echo $checked;?>" <?php if ($checked == 0) echo 'sold'; ?> />
[/php]

something like that let me know

sorry, bit confused, with that code will it say sold out next to size? e.g

large (sold out)

in the select list?

also i dont want it to be selected?

or if its easier just remove the size from the select list, how would i do that

$checked = $result[‘sold’];

what is that to your code

size or sold

i have made a mistake i have just seen that i have used a check box. this is incorrect…

<input type=“checkbox” name=“sold” value="<? echo $checked;?>" <?php if ($checked == 0) echo 'sold'; ?> />

to show the item is out of stock there are two ways. i would like to know both so can decide.

one would be to just the size that has run out just not have it in the list. (this is the easier) i have the code but cant get it to work

SELECT *
FROM poochieProd, poochieCat, poochieSizes, poochieStock
WHERE poochieProd.CatID = poochieCat.CatID AND poochieProd.ProdID = poochieStock.ProdID AND poochieSizes.SizeID = poochieStock.sizeID AND poochieProd.ProdID = var1 AND poochieStock.sold !=1

then if a value of 1 is in the poochieStock.sold it will not show.

this isnt however working for me.

the other is to have the words “soldout” nest to the size that is sold out. With this option however i would need to stop the user selecting this size with either an alert say please choose another size or if they do still choose this size send the to a contact page…

any help would be greatly appreciated

Sponsor our Newsletter | Privacy Policy | Terms of Service