Jump to content

budimir

Members
  • Posts

    522
  • Joined

  • Last visited

Everything posted by budimir

  1. OK, so you could use my code I gave you, but as mac_gyver said you could end up with the same invid on more records if few users open that form at same time. If you want to continue with that concept you should check if invid you're inserting already exists in DB before storing data in DB.
  2. Can you give us table structure?
  3. <label for="textfield">Repair ID Number:</label> <input name="invid" type="text" value="<?php echo '".$new_repair."'; ?>" id="invid" size="3" onKeyDown="limitText(this.form.invid,this.form.countdown,3);" onKeyUp="limitText(this.form.invid,this.form.countdown,3);"; /> But before that you need to use the select query to get the max invid you have in database. Do you know how invid is setup in you're DB? Is that autoincrement field? Who setup the database?
  4. SELECT MAX(invid) as last_inserted FROM table_name Php part $data = mysqli_fetch_row($query); $last_inserted = $data["last_inserted"]; $new_repair = $last_inserted + 1; That's a simple solution, if that is what you need.
  5. What do you get when you echo $year = $_POST['year'];? Also, can you give us error which you recive?
  6. I guess what you need is not ID of inserted row, because that is not relevant to user. I would suggest that you create a column called document number or repair number or whatever. When you create new repair you call a query on you're database, get max repair number and add one or whatever you want it to be. That way you will always have automatic repair number. ID in database you should set to autoincrement and add primary key to it. Is that what you need?
  7. Guys, thanks for all you're help. I found a problem and it was on another script that was inserting data into that table. Something happened during the scheduled start and it didn't finish inserting all the records. Found the problem, fixed it and now I can get all the records I need. Once again, thanks for you're help.
  8. Yes, it didn't return any results.
  9. Hi, I need some help with the query to find duplicate rows on specific value. I have tried many queries, but I can't find it. For now I have this. My sql structure: id INT(11) NOT NULL AUTO_INCREMENT, vrijeme TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, pocetni_broj VARCHAR(55) DEFAULT NULL, zamjenski_broj VARCHAR(55) DEFAULT NULL, glavni_broj VARCHAR(55) DEFAULT NULL, postoji_zamjena INT(1) DEFAULT NULL, PRIMARY KEY (id) And my query is: SELECT * FROM zamjene_brojeva GROUP BY glavni_broj HAVING COUNT(glavni_broj) > 1 Thta is giving me all duplicate values in table. But how do I find duplicate values where column glavni_broj has value 966 45 19-68? I know that there is 4 rows with that value in glavni_broj. I have tried to put Where in that, but than query fails. Any ideas how to do it?
×
×
  • 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.