Jump to content

TransmogriBenno

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by TransmogriBenno

  1. I assume that file wrappers work for FTP connections. You could try using a file wrapper with fopen in append mode. If that doesn't work, you could download the file, use string concatenation to append the new lines, and then upload the new version. That could get problematic if there are several copies of your script hitting the server at once.
  2. That code gives you the first day of that week. You then add another 6 days to get the last day of the week, and then get the month name again. If they are different, you know the week spans two months. Alternatively, you could see if the day of month + 6 is more than the number of days in the month. That way you can delay working out the month name a second time, in case you don't need to. But it's probably not a real performance issue, anyway.
  3. You would just add a where clause, then. <?php $query = "SELECT MAX(ID) AS SaveID, user, sentfile, date, received FROM uploaded WHERE received = 'N' AND user = {$user} AND sentfile = {$filename} GROUP BY user, sentfile, date, received HAVING COUNT(ID) > 1 "; ?>
  4. How are you connecting to the remote server: FTP, SMB, NFS, ...?
  5. Sending to multiple recipients is the same as when you send regular e-mail, just put a comma between the addresses, e.g. "Person A" <a@a.com>, "Person B" <b@b.com>. Or you can use CC and BCC headers if that's what you're after.
  6. Something like the following? "UPDATE table_name SET field_name = field_name + {$new_value} WHERE id_field = {$key}"
  7. 1. The URL www.mydomain.com/index.php?p=guides is wrong, p= and page= are not the same thing. 2. Are the files that you want to load in the subdirectory "hubs"?
  8. 'Cape Town Alive - Cape Xtreme Booking Request' <br> 'Name:' There are a few problems with this, 1. The string(s) isn't/aren't enclosed properly 2. HTML in an e-mail message isn't generally going to work unless you specify that the e-mail is HTML-formatted 3. There are extra semi-colons which need to be removed A solution would be something like: "Cape Town Alive - Cape Xtreme Booking Request\nName:" Assuming that your MTA auto-converts \n to \r\n, which may be a bad assumption...
  9. The above SQL might work, but only if the DBMS supports subqueries in DELETE queries, and it will only delete one row at a time, which is probably not so great because you have 3 copies. I'd be wanting to delete two of them so that only one is left. You obviously want to reference the row(s) that you want to delete by the ID. It's easy, if a little slower, to do two queries - one to find the record(s) you want to delete, and a second query to do the deletion. How about something like this, which would remove all duplicates: 1. find latest duplicate SELECT MAX(ID) AS SaveID, User, Filename, Date, Received FROM uploaded GROUP BY User, Filename, Date, Received HAVING COUNT(ID) > 1 2. remove prior duplicates foreach ($row) { ... // make row values safe for insertion ... DELETE FROM uploaded WHERE ID != {$row['SaveID']} AND User = {$row['User']} AND ... // do equality check for all columns ... }
  10. You would have to have some sort of network mapping if you want a script running on machine A to be able to delete files on machine B.
×
×
  • 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.