Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by techker

  1. so this should update only the products selected and not put 0.00 on the others..
  2. i don't see how i can make this in a inner join? SELECT * FROM TbItemInventory INNER JOIN xcart_pricing ON productid =XcartID;
  3. no?but im shure it would to the same no?
  4. Hey guys im updating a database every day with a script i did that check's a DB file and changes the prices in the pricing DB according to the file.. now the issue is when the product is not in the DB file it puts the prices at 0.00$ in the priciing DB.. is there a way to update all the products in the DB file and keep the others at the price it is already set in the pricing DB?? this is the query: $sql2 = "UPDATE xcart_pricing p LEFT JOIN TbItemInventory pp ON p.productid = pp.XcartID SET p.price = pp.SalesPrice2 WHERE p.productid = pp.XcartID"; $retval = mysql_query( $sql2 ); if(! $retval ) { die('Could not update data: ' . mysql_error()); } echo "Updated data successfully "; TblInventory is a OBDC file uploaded from an access DB file every night(DBSync for MS Access & MySQL really cool app converts access to mysql and uploads it.) the file is basically the POS system So it uploads to the DB then i compare the xcart pricing DB to the TBLInventory DB .. am i clear?lol
  5. ok..i will figure it out..lol thx a bunch for the help!! is there any tutorials for this ?
  6. well i select the brand but i want the id to search the database.no good?
  7. look at this one http://x81.tech-design.ca/script/test_mp.php i added <? print_r ( $_POST["Product"]);?> <? print_r ( $_POST["Brand"]);?>
  8. can i print in a input box the selected brand and product ? cause i get what your saying but it still does not stay loaded on the selected brand and product..
  9. when i select brand it jumps to products but brand goes back to Brand instead of staying on the selected brand? maybe the link would help http://x81.tech-design.ca/script/test_m.php
  10. oK so now it works i had another typo Products_Nneeded to be product_N echo ("<option value=\"$row[Product_id]\" " . ($Product_N == $row["Product_N"]? " selected" : "") . ">$row[Products_N but now it works but when i select the product it resets the form back to brand? i need to keep it selected..
  11. <?php $Brand_N = $Product_N = null; //declare vars $conn = mysql_connect("localhost", "1", "2"); $db = mysql_select_db('3',$conn); if(isset($_POST["Brand"]) && is_numeric($_POST["Brand"])) { $Brand_N = $_POST["Brand"]; } if(isset($_POST["Product"]) && is_numeric($_POST["Product"])) { $Product_N = $_POST["Product"]; } ?> <script language="JavaScript"> function autoSubmit() { var formObject = document.forms['theForm']; formObject.submit(); } </script> <form name="theForm" method="post"> <select name="Brand" onChange="autoSubmit();"> <option value="Brand">Brand</option> <?php $sql = "SELECT * FROM Brand"; $Brand = mysql_query($sql,$conn); while($row = mysql_fetch_array($Brand)) { echo ("<option value=\"$row[brand_id]\" " . ($Brand_N == $row["Brand_N"]? " selected" : "") . ">$row[brand_N]</option>"); } ?> </select> <?php if($Brand_N!= null && is_numeric($Brand_N)) { ?> <select name="Product" onChange="autoSubmit();"> <option value="Product">Product</option> <?php $sql = "SELECT * FROM products WHERE Brand_id = $Brand_id "; $Products = mysql_query($sql,$conn); while($row = mysql_fetch_array($Products)) { echo ("<option value=\"$row[Product_id]\" " . ($Product_N == $row["Product_N"]? " selected" : "") . ">$row[Products_N]</option>"); } ?> </select> <?php } ?> </form> <? print_r ( $_POST );?>
  12. ok i got your point..lol i changed it to uppercase like all of it.now it shows the second drop down but empty Array ( [brand] => 1 [Product] => Product )
  13. typo error in the select box by default it is writen brand when i select a brand it just resets to brand
  14. odd select box (Brand) Array ( [brand] => 1 )
  15. ok so i changed it all to the select name..but still nothing?is there a way to echo the results so that i can see when i select a brand the output? if(isset($_POST["Brand"]) && is_numeric($_POST["Brand"])) { $Brand_N = $_POST["Brand"]; } if(isset($_POST["Product"]) && is_numeric($_POST["Product"])) { $Product_N = $_POST["Product"]; }
  16. ok so im started to get it..lol if(isset($_POST["Brand_N"]) && is_numeric($_POST["Brand_N"])) { $Brand_N = $_POST["Brand"]; } if(isset($_POST["Product_N"]) && is_numeric($_POST["Product_N"])) { $Product_N = $_POST["Product"]; } so i need to change the product post to..
  17. sorry im rusted out..i don't get it..brand is the db name. echo ("<option value=\"$row[brand_id]\" " . ($Brand_N == $row["Brand_id"]? " selected" : "") . ">$row[brand_N]</option>"); ???
  18. so it's just this part?i modified it but still.. <?php $sql = "SELECT * FROM Brand"; $Brand = mysql_query($sql,$conn); while($row = mysql_fetch_array($Brand)) { echo ("<option value=\"$row[brand_id]\" " . ($Brand_N == $row["Brand_id"]? " selected" : "") . ">$row[brand_N]</option>"); } ?> </select> <?php if($Brand_N!= null && is_numeric($Brand_N)) { ?> <select name="Product" onChange="autoSubmit();"> <option value="Product">Product</option> <?php $sql = "SELECT * FROM products WHERE Brand_id = $Brand_N "; $Products = mysql_query($sql,$conn); while($row = mysql_fetch_array($Products)) { echo ("<option value=\"$row[Product_id]\" " . ($Product_N == $row["Product_N"]? " selected" : "") . ">$row[Products_N]</option>"); } ?>
  19. hey guys i can't seem to get my second list box to work? the first one is good it shows the brands but the second one does not show at all? i have 2 DB Brands and others products so in brands i have id and name .. second i have product_id-product_Nand Brand this is my query(select the brand then it list the products that are associated with the brand) <?php $Brand_N = $Product_N = null; //declare vars $conn = mysql_connect("localhost", "2", "2"); $db = mysql_select_db('2',$conn); if(isset($_POST["Brand_N"]) && is_numeric($_POST["Brand_N"])) { $Brand_N = $_POST["Brand_N"]; } if(isset($_POST["Product_N"]) && is_numeric($_POST["Product_N"])) { $Product_N = $_POST["Product_N"]; } ?> <script language="JavaScript"> function autoSubmit() { var formObject = document.forms['theForm']; formObject.submit(); } </script> <form name="theForm" method="post"> <select name="brand" onChange="autoSubmit();"> <option value="Brand">Brand</option> <?php $sql = "SELECT * FROM Brand"; $Brand = mysql_query($sql,$conn); while($row = mysql_fetch_array($Brand)) { echo ("<option value=\"$row[brand_id]\" " . ($Brand_N == $row["Brand_N"]? " selected" : "") . ">$row[brand_N]</option>"); } ?> </select> <?php if($Brand_N!= null && is_numeric($Brand_N)) { ?> <select name="Product" onChange="autoSubmit();"> <option value="Product">Product</option> <?php $sql = "SELECT * FROM products WHERE Brand = $Brand_N "; $Products = mysql_query($sql,$conn); while($row = mysql_fetch_array($Products)) { echo ("<option value=\"$row[Product_id]\" " . ($Product_N == $row["Product_N"]? " selected" : "") . ">$row[Products_N]</option>"); } ?> </select> </form> <?php } ?>
  20. ok that looks like what i need. whats IsValidated BOOL and the echo would be what? $q3=SELECT s.FirstName, s.LastName, CASE ss.IsValidated WHEN 1 THEN 'Yes' ELSE 'No' END AS Validated FROM Student s JOIN StudentSick ss ON s.StudentID = ss.StudentID WHERE ss.SickDay >= DATE_SUB(NOW(), INTERVAL 48 HOUR); $res3 = mysql_query($q3); $row3 = mysql_fetch_assoc($res3); <?php echo $row3['Validated'] ?>
  21. table is not done yet..figuring out what would be the best way to do this. student DB Sick DB 2 diffrent Db for shure.
  22. Sorry.. So every time a student calls in sick they put it in the filling and it needs to be valid whiten the 48h fallowing the log.. So basicly i set up a script for al students.then i have a table called sick ID-student id-date called-valid. so buy default the valide is no when it is validated they press validated.so it goes to yes.
  23. Hey guys im making a script for a school and i need to check the database for non validated absences in the last 48hours? would it be something like SELECT * FROM YOUR_TABLE t WHERE t.datetime_column < DATE_SUB(NOW(), INTERVAL 48 HOUR) how do i add in colum validated if it says no?(yes when validated)
  24. Hey guys the Linux help section is the only place i can't post??
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.