close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Stock control

Thread began 3/13/2009 8:07 am by warrenphillips25336771 | Last modified 9/24/2009 1:04 pm by warrenphillips25336771 | 12302 views | 32 replies

warrenphillips25336771Beta Tester

Hi jon and ray

thanks to you both, I have used lynda.com but due to my job (i drive truck here in the uk) i only part time design so getting to watche the darn videos is a pain, I got the stock control done for $20 by a coder, so all is not lost but ray, where was that answer a long time ago? :) I know i need to learn it, i wish i had the time for someone to sit down and teach me php so that i can just code like i do with html/css. but i agree lets keep the thing going for now, this is the code used on my cart.php page

On my cart.php page it is like this (just to make sure they can't add anything if bought before checkout and passed to paypal,)

$avail_stock = $_POST['txtstockQty'];
mysql_select_db($database_beads2, $beads2);
$query_RSclasses = "SELECT * FROM content WHERE ContentID = 2";
$RSclasses = mysql_query($query_RSclasses, $beads2) or die(mysql_error());
$row_RSclasses = mysql_fetch_assoc($RSclasses);
$totalRows_RSclasses = mysql_num_rows($RSclasses);

<script type="text/JavaScript">
function checkstock(v1,name1){
var value1=v1;
var x=name1.length;
var pnum = name1.substring(15,name1.length);
var cname = "qty" + pnum;

var avail_stock=document.getElementById(cname).value;
var pur_stock = document.getElementById(name1).value;
if(parseFloat(avail_stock)<parseFloat(pur_stock)){
alert("The available stock is "+avail_stock);
for (var i=0;i < document.cartfrm.elements.length; i++) {
if (document.cartfrm.elements[i].type=="text" && document.cartfrm.elements[i].name==name1) {
document.cartfrm.elements[i].value="";
document.cartfrm.elements[i].focus();
return false;
}
}
}

}
</script> (feel free to use if needed)

and also this

<?php
while (!$Beads->EOF()) {
$item_id = $Beads->DisplayInfo("ID");
mysql_select_db($database_beads2, $beads2);
$sql = "SELECT * FROM items WHERE ItemID=".$item_id;
$Result = mysql_query($sql, $beads2) or die(mysql_error());
$rs = mysql_fetch_assoc($Result);
$stock_qty=$rs['ItemAv'];

?>

ray please correct me if you feel anything like this is wrong. Hope this helps people out there,

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...