Basicly what im trying to do is have a "products" page check a js file for an "in stock" or "out of stock" and write that to the "products" page.
The reason I want to do this is because the products will be listed on multiple pages and I dont want to have to edit the pages to say in stock etc, also I want to make the stock file easy to edit for a person who doesnt know much more than how to write emails.
So my idea is to have the list in the js file;
300 = 1
301 = 0
302 = 1
303 = 1
where the 300 number is the product number and the 1 or 0 is the in stock or out of stock. Hopefully I can add an if 1 write "in stock" else 0 write "out of stock"
Then the script on "products" page will just have to check the js file for the result for the product number.
I'm sure there are a ton of ways to go about doing this, but could someone help me get the ball rolling on the code I have tried and each time it returns absolutely nothing, so I'm way off so far.
So using the script you provided Dinkar, would I be able to have that in an external file and use $productID = "304"; on several different pages to check availability. I don't want to have to update each product page, just a master stock page, to change all the different products. How would I ask it to call up a certain php file and check it there just like I did in js.
Tried that, and it actually doesnt work. It will only display the first include.
I also tried adding the include with each product, and most work fine but the first one on the page will always no matter what the value display an "out of stock"
Sorry for all the posts, but I think i've found an easy solution. The only thing is (just like my original js) you have to type the words "in stock", "out of stock" rather than do the 1, 0 thing, but it works! also the variable cannot be a number so I used our full product code which works out perfect because it starts with a number.
[code]
Stock file:
<?php
$rb300 = "In Stock";
$rb301 = "Out of Stock";
?>
Product page:
<?php
include ("stock.php");
echo "$rb300 <br>";
?>
[code]
There we have an easy solution, assuming there isn't some other kind of bad thing I don't know about.
Yes, I totally agree that MySQL is better for most jobs like this. The company this is for will not ever have more than 25 - 30 products, and as I said has to be some what easy to update for a non-web person, the business owners (my compter illiterate parents) LOL
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
You have not yet logged in, or registered properly as a member
You are a member, but no longer have posting rights.
This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.