Jump to content

guyfromfl

Members
  • Posts

    286
  • Joined

  • Last visited

    Never

Everything posted by guyfromfl

  1. the repair field is the tech's explanation of what he did to fix the engine. We are a small company, about 8 people so I can get away with slack names like that , especially since I'm the only one who knows how to even open the editor for the code. We manufacture model trains...
  2. Thanks for the tip. I am using the database to test the condition, not php. The code I am writing determines the state of a warranty repair. If the repair field is empty, the repair has not been complete. I am doing it this way so the user doesn't have to check a checkbox to tell the computer something it can figure out. Is there a better way?
  3. it hit me as soon as i posted it and re-read it. I was seperating the SET columns by an AND no a "," I feel dumb
  4. I have been struggling with this sql line for a few days now, and it is really backing this project up. I have php spit out $sql in a die() command, and it looks good. I also have php tell me how many rows the same line returns when I convert it into a select. Can someone please help me find the problem with why this simple update does not work. // I left the date command that creates the date and hard coded the date into this example for testing purposes. $sql = "UPDATE repairs.raitem SET repairDate='2010-05-06' AND repairTech={$_SESSION['user_id']} WHERE repairs.raitem.repair IS NOT NULL AND repairs.raitem.repairDate IS NULL AND repairs.raitem.id={$raitem['id']} LIMIT 1"; ANY help is much appreciated! EDIT: What I get is repairDate and repairTech are still NULL after the sql is run. No errors.
  5. What is the best way to remove rows from one table that does not have children in another table? I want to go through all the table1 entries and if table2.table1id does not return anything, then delete table1's entry table1: id <misc data> table2: id table1id <misc data> So what I need is something like DELETE FROM table1 where < COUNT(SELECT * FROM table1id) = 0 Another way to say it is I want to delete all the orders (table1) that do not have any line items (table2)...
  6. gizmola, That was what I was thinking, but i was wondering if there was a better way. Is there a way to make MySQL do a while statement? or will that part have to be in my script? kickstart, thanks for the SQL, I will try it out. I am using PHP. That way if there is an update to the program, only 1 computer needs the update. We were using Access but everybody wants an updated system so I was told to do whatever to make a better system. The parts ordering part of the software is a huge hit and has worked for 30days now with no problems. so for a small company this system will be good.
  7. Keith, That relation is exactly what I am trying to figure out. from the table i posted before, how is the best way to say that customer 1033's #5011 has already been repaired 2 other times when it comes in on RA1400 I know it is possible that customer 1033 has 3 5011s but for right now I want to keep it simple. I am about to just create a table on each RA that has a list of all 1033's repairs and call it a day. The deadline is comming up quick nadeemshafi9, I was making the same point with the select * where stockNum=5011... I think the table of all customer 1033s records is gonna be the way to go.
  8. Yea its kind of complex, these are the actual table names and some of the fields: repair: repairId (primary key) custId (relates to the the customer ID in the customer table..) repairItem: (Has many entries per repairId .. iow #RA1000 can have alot of engines to be returned on.) repairItemId (primary key) repairId (relates to repair.repairId) So the tables would look like this according to my 1st example: repair: repairId custId 1000 1033 1200 1033 1400 1033 repairItems: repairItemId repairId stockNum 1 1000 5011 2 1000 2020 3 1000 5075 4 1200 5011 5 1400 5011 So your eye can see that 5011 came in on 1400, 1200 and 1000, but how do you make the computer know that? Now when the user opens RA1400, how do I display a table with links to the other 2 RAs? I can't use WHERE stockNum=5011 because 5011 isn't specific to that repair since we made say 300 products with the stock number 5011... I hope that helped clearify it, please ask if not
  9. I don't know.. Everything is related to the customer, a parts order, ra, issues etc. You find the customer, then open the return authorization. So I need to find all the times his specific product has been to the shop and all the passed RAs that it came in as. My SQL class didnt really get into many:many relationships like this. I could make a previousRepair field in the RAItems table and query until that field is null, or build an array, but there has to be a better way.
  10. I am working on my company's service department software I have been working on for about a month. I have a question for the experts.... Table structure: ReturnAuthorization (contains all the who, and when...) ReturnAuthorizationItems (contains all the what products came back and what was done) Basically, I am creating the return authorization for warranty repair part of the program. Lets say you buy 3 of our products, but they are broken out of the box, you send it to our repair station with RA #1000. We repair the items, but one is still not fixed so you have to send it in again for a second time. When you send the product back for the second time it is comming in on RA #1200 with a higher priority. That part is not really a big deal. Where I am going with this, is what if RA #1200 isn't fixed, and it comes back on RA #1400. Now, I have to make the software recognize RA#1400 came back on RA#1200 that came back on #1000, so the tech can easily pull those records to see what was already done. The other 2 items on #1000 are ok, so they are ignored. When the tech pulls up RA #1400, he can see that particular item has been in on #1200 and #1000 before that. So basically how do I relate multiple children tables of a specific parent table to another new parent table. I really don't even know how to put that in words, hopefully you get the idea. Would it be best to pull the passed RAs from the items table to an RA in my software, then create individual queries or is there a way to query that data all on the DB? I really hope someone understands all that! Thanks in advance for the help
  11. BUMP! I'm trying to send a confirmation an order was shipped but 99% are being bounced back as spam ANY HELP!?????
  12. Thats funny about the cert thing... I have applied at several jobs Id rather be doing but nobody will hire because I dont have that/those peices of paper... my best option other than my job now is to start as entrylevel programmer for a website hosting company.. The only reason Im still at this job is the pay isnt much different and there are 8 people in my current company and i would feel like im betraying them.. If i get a job that pays more than $1/hr more im getting already im gone with the wind ! Thanks for the input. I guess Ill just have to see what time has to offer me.
  13. You can configure Apache to handle requests on different ports than 80 so they could type http://<ip address>:<dedicated port number> but i doubt he would let me get in there and make those changes I created desktop short cuts on all the user's computers so they wouldn't even have to worry about doing something different.
  14. Ha, he won't let me near anything. I tried to help him change a stick of RAM once because he was going on 45 minutes but I couldnt touch anything. The machine the script is on (my computer) is running WAMP server, and POSTCAST server for sending mail, nothing special. The problem is probably in that we are on a windows server 2k3 dns and he might be restricting my incomming requests. What I am affraid of, is if I were to put it out on the windows server, IIS will screw with apache and I won't be able to get in there and configure it so the co-exist. so I might have done this whole project in vein.
  15. Everything I am doing is in the building. I have a server at home I could run it from, but hey already said they didn't want to store customer info "out on the internet"... I created a knowledge base for the customers that runs off that like a charm. Everybody using my application types in the lan address (http://192.168.2.x [my ip address]) to access it. Right now I am "testing" the info on my computer at work, then if everything goes well, they will let me put it on the company's data server. The problem is the "IT" guy is the GM and barley knows how to boot a windows xp home computer. Thats why i wanted to see what I could do so it wouldn't effect him.
  16. To send use postcast smtp server. I just added this to my setup so I can send order confirmations from php.
  17. I made a parts ordering, invoicing and shipping script for my work. I used PHP because it would be easier to update it since it would only be done on 1 computer and the web browser would provide the interface... Anyways, I spent a week writing the code up until 3 or 4 in the morning then going to work at 8am. Now, they are talking about not using it because on other machines, it takes up to a minute to load a new page. The problem is because the "IT" guy lets a remote branch of the company use 2 remote desktop sessions, sucking our bandwidth dry. He won't change that system since it was in place before I came along. Is re structuring php code going to buy me any time or is this lag created solely in the router?
  18. Yea thats it, I dont know why I was getting an error when i was trying that before, i think its because I didnt tell it what to alias it as maybe? I dunno but thats what I was looking for Thanks!
  19. basically multiply qty and price from row 1, then mulitply qty and price from row 3 then add it together. My script is already doing it in php, I just wanted to see how it works if I get it from the db and leave it all in the mysql database.
  20. Yea im making an invoice system in php. I have 2 tables parts.invoice (customer data record of the invoice....this has a total field) and parts.invoiceitems (individual things a customer buys.) so if I add a new item after the invoice is generated, I want to have a new total to put in parts.invoice.total. and when I add an item to the order, I have to update the invoice total. I have php creating the subtotals for the invoice, but I was tinkering with the idea of doing it all on the database. Any suggestions?
  21. ok lets say I have a table -------------------------------- | id | invoiceId | qty | price | -------------------------------- |1 | 10354 | 2 | 5 | |2 | 10356 | 3 | 6 | |3 | 10354 | 4 | 1 | -------------------------------- I want to multiply qty * price where invoiceId=10354 then add the sum of each. would it be better to just add a total column? or is there a sql function that i could use? thanks
  22. I am trying to create a dynamic table for an invoice. Firebug keeps returning elqty is null. It was working even when you add a new item, but stopped for some reason, and started giving me that error. the variable is in function updateTotal at the bottom of invoice.js Here are both files, you should be able to copy and paste both and get it to work. invoice.js function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cellSelect = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cellSelect.appendChild(element1); var cellItem = row.insertCell(1); cellItem.innerHTML = rowCount; // + 1; var cellDescription = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; element2.name = "description_" + rowCount; element2.size = "30"; cellDescription.appendChild(element2); var cellQty = row.insertCell(3); var element3 = document.createElement("input"); element3.type = "text"; element3.name = "qty_" + rowCount; element3.id = "qty_" + rowCount; element3.size = "3"; element3.setAttribute("onchange", "updateTotal('dataTable');"); cellQty.appendChild(element3); var cellPrice = row.insertCell(4); var element4 = document.createElement("input"); element4.type = "text"; element4.name = "price_" + rowCount; element4.id = "price_" + rowCount; element4.size = "8"; element4.setAttribute("onchange", "updateTotal('dataTable');"); cellPrice.appendChild(element4); var cellTotal = row.insertCell(5); var element5 = document.createElement("input"); element5.type = "text"; element5.name = "total_" + rowCount; element5.id = "total_" + rowCount; element5.size = "8"; element5.disabled = "disabled"; cellTotal.appendChild(element5); } function deleteRow(tableID) { try { var table = document.getElementById(tableID); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } function updateTotal(tableId) { var table = document.getElementById(tableId); var rowCount = table.rows.length; var elSubttl = document.getElementById("subtotal"); var elTotal = document.getElementById("total"); var total=0; var subttl=0; for (var i=1; i<=rowCount; i++) { var thisElQty = "qty_" + i; var thisElPrice = "price_" + i; var elqty = document.getElementById(thisElQty); var elprice = document.getElementById(thisElPrice); var elttl = document.getElementById("total_" + i); var qty = elqty.value; var price = elprice.value; var priceWithQty = qty * price; subttl = priceWithQty; elttl.value = formatMoney(subttl); //total += subttl; } elSubttl.value = formatMoney(total); elTotal.value = formatMoney(total); } function formatMoney(money) { money = "$" + money.toFixed(2); return money; } in.php <html> <head> <TITLE> Invoice </TITLE> <script language="javascript" type="text/javascript" src="includes/invoice.js"></script> <link href="includes/css/bli.css" type="text/css" rel="stylesheet" /> </head> <body> <?php if ($_GET['action'] == "add") { foreach($_POST as $data) { echo $data . "<br />"; } } else { ?> <form action="in.php?action=add" method="post"> <div width="50%"> <table id="dataTable" width="50%" border="1" style="margin-left: auto; margin-right: auto"> <tr><th colspan="4"> </th><th colspan="2"><input type="button" value="Add Item" onclick="addRow('dataTable')" /> <input type="button" value="Delete Items" onclick="deleteRow('dataTable')" /></td> </th> <tr><th>Select</th><th>Item</th><th>Description</th><th>Qty</th><th>Price</th><th>Total</th></tr> <tr><td><input type="checkbox" name="chk"/></td> <td>1</td> <td><input type="text" name="description_1" size="30" /></td> <td><input type="text" name="qty_1" size="3" id="qty_1" onchange="updateTotal('dataTable');" /></td> <td><input type="text" name="price_1" size="8" id="price_1" onchange="updateTotal('dataTable');" /></td> <td><input type="text" name="total_1" size="8" id="total_1" disabled="disabled" /></td> </tr> </table> <table width="50%" style="float: right; margin-left: auto; margin-right: auto"> <tr><td>Sub-Total:</td><td><input type="text" disabled="disabled" id="subtotal" /></td></tr> <tr><td>Tax:</td><td><input type="text" disabled="disabled" id="tax" /></td></tr> <tr><td>Total:</td><td><input type="text" disabled="disabled" id="total" /></td></tr> <tr><td> </td><td><input type="submit" /></td></tr> </table> </div> </form> </body> </html> <?php } ?>
  23. ugh i think i have it now. for some retarded reason I put session_destroy in the the footer.php I dont know whats worse, looking for a stupid problem for 9 hours and writing agro forum posts, or finding out that you did something stupid to make you stare at code for 9 hours and write agro forum posts.
  24. I added that, no change. If i include instead of use header to redirect after the login it works, but it goes through each of the if statements that check the $_SESSION status like they are all true. I am at my wits end
×
×
  • 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.