Jump to content

JChilds

Members
  • Posts

    86
  • Joined

  • Last visited

    Never

Everything posted by JChilds

  1. The string will always be different(in both cases), but the format the same .
  2. Hi guys, I have been playing with regex, but it and I really do not get on apparently. How would I go about matching '1234' in this expression: (123|789,1234) And, How would I get this as an array in php (im not sure if regex is the correct thing to use here) ' _x[5,1,0,0,0,0,0,0,1,0,1,4,4,9,10,5]' (the values within the [] obviously.
  3. Seems to be some confusion on the priority also. Here is a graphical example: If priorities are the same, the current drill is to be assigned to the station with the lowest number of drills at present. I was thinking about another way to do it: - Get list of x,y coords for drills for each station - Compare the arrays and delete duplicates depending on priority. - if no priority, rely on size of each array to decide.. Is this a good/possible way to do it? Or is it not practical?
  4. Hi, Thanks for that, but it has got me mighty confused. I have spent some time going over it and i'm wondering is it possible to have a separate distance for each station(assigned at same time where priorty is assigned)? Also. If the drills are not within the specified radius of any station, they are not included. Sorry I am being a pain. I only know the basics of php and have really jumped in the deep end i think.
  5. xyph, You are correct. I currently use this to get all drills within a certain radius. $query = " SELECT * FROM $table WHERE (SQRT( ($x-x)*($x-x)+($y-y)*($y-y) ) < $radius ) "; sample data: x y 500 485 517 514 495 515 504 481 518 501 499 506 501 518 507 487 495 500 486 507 510 493 513 516 513 514 505 511 504 489 512 515 503 513 511 515 478 499 stations: 500,500 480,490
  6. xyph, The lists of drills are already assigned to each station. But there are alot of double ups (two or more stations being assigned the same drill) There can be 200 or more drills assigned to each station. IF two stations have the same priority, the current drill is assigned to the station with the least amount of drills currently assigned to it.
  7. It also has to be a possibility for two stations to have the same priority. (if this happens, I have to assign the current doubled up drill to the station with the least amount of drills assigned to it)
  8. Only one drill can go to each station. To specify a little further: Each Station already has a list of drills within its radius. But a drill cannot be assigned to more than one station. Where as at the moment the stations are assigned to all drills within their radius, so there are alot of doubles.
  9. I have a file with id_12345 randomtext id_987459768 This code gets me 'id_12345' but I only want it to return 12345 Is this possible? /id_[1-9]?\d+/g
  10. If you imagine the three stations having rings (radius) around them. This radius can well and truely overlap a near by station. Only the 'overlap' of the rings is to be split/prioritized.
  11. I have a list of x,y coordinates. (drill positions) I have Three Primary x,y co-ords. (station positions) I want to assign drill positions to stations based on how close they are and the priority of the station(1, 2 or 3). I also want the option of making all stations have a priority or 1 so they divide equally.(for drill positions that are close to two stations) I have absolutely no idea how to tackle this. Is there a formula anyone is aware of? Can anyone even attempt to show me how to tackle this. I am 100% lost.
  12. Im not very well versed in mysql at all. id is int(11) There are no relationships defined in 'designer' in phpmyadmin
  13. It is going to be ongoing. I understand it is going to be slow. That is why I am here, to see if there is a better way of doing it. As a general rule, only ~ 1000 records will need to be updated(each time) as most of the 'problems' are the more recent jobs.
  14. This is what I will probably be using: Can anyone see any problems? DELETE from table1 WHERE id = $id UPDATE table1 SET id = id - 1 WHERE id > $id And the same for table2
  15. ...ok I need to be able to remove jobs(id) without there being a trace of them, so even if someone wanted to they couldn't tell they were there.
  16. The only thing I can think of is not pretty. - Get ID number - Delete that row - Minus one off every ID that is larger than that id
  17. Its hard to explain why, but that is not an option here. There can be no missing numbers
  18. Thanks for the reply ronverdonk. Sorry it has taken me this long to respond, work was crazy this morning. The problem is that this ID does infact correspond to another table in which I have to do the same thing, except ID is not unique there. File_id in table1 is unique File_id in table2 can have alot of items. Thanks for the help thus far
  19. I have a table with 35,000 rows. Row 1 has a cell with ID 1 Row 2 has a cell with ID 2 etc etc There are a heap of rows that should not be in there and I want to remove them. I want to delete any trace of them, so just deleting the row wouldn't work, as the ID's would skip a number. So I need to change all of the ID's 'up' one. Is there an easy way to do this? As I am totally stumped.
  20. mysql_query('SELECT * FROM `tendered` WHERE DATE(`timestamp`) LIKE $sterm') or die(mysql_error()); Where $sterm = 2010-08-28 and `timestamp` are in format 2010-07-26 17:30:29 I get error "Unknown column '$sterm' in 'where clause'" I have no idea what could be wrong
  21. Hi all, I have been stuck on this for ages and have no idea what is wrong. Nothing is happening (iin the database) Here is the doce <?php $host="localhost"; $username="root"; $password=""; $db_name="TMT"; // Reusable connection for my own sanity: // Establish database link $mysql_twtamer = mysql_connect($host, $username, $password) or die ("Cannot make the connection"); mysql_select_db($db_name, $mysql_twtamer) or die ("Cannot connect to the database"); mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select db"); $barcode = $_POST['Barcode']; $description = $_POST['Description']; $code = $_POST['Code']; $previous_price = $_POST['Previous_Price']; $invoice_price = $_POST['Invoice_Price']; $qty_ordered = $_POST['Qty_Ordered']; $qty_delivered = $_POST['Qty_Delivered']; echo $barcode."<br>"; echo $code."<br>"; echo $description."<br>"; echo $qty_delivered."<br>"; echo $invoice_price."<br>"; mysql_query("INSERT INTO items(Barcode, Code, Description, Qty, Price) VALUES('$barcode', '$code', '$description', '$qty_delivered', '$invoice_price'"); $new_qty = $i - $qty_delivered; mysql_query("UPDATE invoices SET qty = $new_qty WHERE qty=$i AND code=$code"); ?>
  22. It's ok. Currently running both systems (the old, and my in progress new) side by side so I still have the old ones records (in ms sql), plus the ones I uploaded. I have written a touch screen POS in vb, and the database is mysql, which is where I wish I was more skilled.
  23. Woops, Makes more sense Now to revert to the dump I uploaded.
×
×
  • 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.