i have a product table and a stock table aswell as a few more. 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
ignore a record if = 0 not working and alternatives
Moderator: General Moderators
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: ignore a record if = 0 not working and alternatives
The first question is why this is not working? What happens is you do just:jonnyfortis wrote: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.
SELECT *
FROM poochieProd, poochieCat, poochieSizes, poochieStock
WHERE poochieStock.sold !=1
There are many ways to do this. If you are using a <select> then you could have Javascript check for the sold-out sizes and display the message (and not allow those sizes to be selected). Or you could use PHP to mark them as sold-out in the select and give them a special value like -1 so they will be ignored with the form is submitted. You could also show the sizes as radio buttons and use PHP to not generate a radio button for the sold-out sizes.jonnyfortis wrote: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
(#10850)
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: ignore a record if = 0 not working and alternatives
> Or you could use PHP to mark them as sold-out in the select and give them a special value like -1 so they will be ignored with the form is submitted.
this sounds like what i want to do. Any guidance on how this is done?
thanks
this sounds like what i want to do. Any guidance on how this is done?
thanks