php-general Digest 2 Aug 2013 21:04:10 -0000 Issue 8318
Topics (messages 321757 through 321771):
How to delete 3 months old records in my database?
321757 by: Karl-Arne Gjersøyen
321758 by: DuÅ¡an NovakoviÄ
321759 by: Simon Griffiths
321760 by: Karl-Arne Gjersøyen
321761 by: Simon Schick
321762 by: DuÅ¡an NovakoviÄ
321764 by: Jim Giner
Re: Sending headers to server
321763 by: Matijn Woudt
321765 by: Miguel Guedes
321766 by: Karim Geiger
321767 by: Miguel Guedes
321768 by: Karim Geiger
321769 by: Miguel Guedes
OT - Internet Troubles?
321770 by: dealTek
Just passing this along: Free Book
321771 by: Tamara Temple
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hello again, folks!
I wish to delete records in my database that is older than 3 months.
$todays_date = date('Y-m-d');
$old_records_to_delete = ???
if($old_records_to_delete){
include(connect.php);
$sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'";
mysql_query($sql, $connect_db) or die(mysql_error());
}
Thank you very much for your help to understand also this question :)
Karl
--- End Message ---
--- Begin Message ---
$query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
INTERVAL 3 MONTH AND NOW()"
On Fri, Aug 2, 2013 at 12:58 PM, Karl-Arne Gjersøyen <karlar...@gmail.com>wrote:
> Hello again, folks!
> I wish to delete records in my database that is older than 3 months.
>
> $todays_date = date('Y-m-d');
> $old_records_to_delete = ???
>
> if($old_records_to_delete){
> include(connect.php);
> $sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'";
> mysql_query($sql, $connect_db) or die(mysql_error());
> }
>
> Thank you very much for your help to understand also this question :)
>
> Karl
>
--
mob: + 46 7 230 230 19
web: http://novakovicdusan.com
Please consider the environment before printing this email.
--- End Message ---
--- Begin Message ---
Hello,
Try something like:
$oldDate = new DateTime();
$oldDate->sub(new DateInterval('P3M'));
$old_records_to_delete = $oldDate->format('Y-m-d');
Hope this helps,
Si
Sent from my iPhone
On 2 Aug 2013, at 11:58, Karl-Arne Gjersøyen <karlar...@gmail.com> wrote:
> Hello again, folks!
> I wish to delete records in my database that is older than 3 months.
>
> $todays_date = date('Y-m-d');
> $old_records_to_delete = ???
>
> if($old_records_to_delete){
> include(connect.php);
> $sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'";
> mysql_query($sql, $connect_db) or die(mysql_error());
> }
>
> Thank you very much for your help to understand also this question :)
>
> Karl
--- End Message ---
--- Begin Message ---
2013/8/2 Dušan Novaković <ndu...@gmail.com>
> $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
> INTERVAL 3 MONTH AND NOW()"
>
This delete everything from now and 3months backwards. I want to store 3
months from now and delete OLDER than 3 months old records.
Karl
--- End Message ---
--- Begin Message ---
On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen <karlar...@gmail.com> wrote:
>
> 2013/8/2 Dušan Novaković <ndu...@gmail.com>
>
> > $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
> > INTERVAL 3 MONTH AND NOW()"
> >
>
> This delete everything from now and 3months backwards. I want to store 3
> months from now and delete OLDER than 3 months old records.
>
> Karl
Hi, Karl
You're right, but restructuring, to get it the way you want, isn't be
that hard, is it? :)
$query = "DELETE FROM `__table_name__` WHERE `__date__` < NOW() -
INTERVAL 3 MONTH"
@Dusan,
Btw: What is "DELECT"? I assume it should've been "DELETE", right?
Bye
Simon
--- End Message ---
--- Begin Message ---
Yeah, just spelling mistake :-)
And yes, it should be:
$query = "DELETE FROM `__table_name__` WHERE `__date__` <= NOW() - INTERVAL
3 MONTH"
Cheers ;-)
On Fri, Aug 2, 2013 at 2:35 PM, Simon Schick <simonsimc...@gmail.com> wrote:
> On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen <karlar...@gmail.com>
> wrote:
> >
> > 2013/8/2 Dušan Novaković <ndu...@gmail.com>
> >
> > > $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
> > > INTERVAL 3 MONTH AND NOW()"
> > >
> >
> > This delete everything from now and 3months backwards. I want to store 3
> > months from now and delete OLDER than 3 months old records.
> >
> > Karl
>
> Hi, Karl
>
> You're right, but restructuring, to get it the way you want, isn't be
> that hard, is it? :)
>
> $query = "DELETE FROM `__table_name__` WHERE `__date__` < NOW() -
> INTERVAL 3 MONTH"
>
> @Dusan,
> Btw: What is "DELECT"? I assume it should've been "DELETE", right?
>
> Bye
> Simon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
mob: + 46 7 230 230 19
web: http://novakovicdusan.com
Please consider the environment before printing this email.
--- End Message ---
--- Begin Message ---
On 8/2/2013 6:58 AM, Karl-Arne Gjersøyen wrote:
Hello again, folks!
I wish to delete records in my database that is older than 3 months.
$todays_date = date('Y-m-d');
$old_records_to_delete = ???
if($old_records_to_delete){
include(connect.php);
$sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'";
mysql_query($sql, $connect_db) or die(mysql_error());
}
Thank you very much for your help to understand also this question :)
Karl
So close! BUT - you need to reverse your test.
where date <= '$old_records_to_delete'
--- End Message ---
--- Begin Message ---
On Thu, Aug 1, 2013 at 4:04 PM, Miguel Guedes <miguel.a.gue...@gmail.com>wrote:
> Hello List,
>
>
> I'm running PHP 5.4.9 as CGI (via apache 2.2.22) and can't seem to be
> able to send headers to the server.
>
> Both,
>
> header('Status: 500 Internal Server Error');
>
> and,
>
> header('HTTP/1.1 500 Internal Server Error', true, 500);
>
> result in nothing happening on the client side.
>
> What am I missing?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Did you print some data before using header?
- Matijn
--- End Message ---
--- Begin Message ---
On 02/08/13 14:10, Matijn Woudt wrote:
Did you print some data before using header?
No, not at all. I've PHP configured to complain about notices, warnings
and errors; would've got a warning about headers already sent, which I
don't get.
--- End Message ---
--- Begin Message ---
Hi Miguel,
On 08/02/2013 10:50 AM, Miguel Guedes wrote:
> Hi Karim,
>
> On 01/08/13 15:40, Karim Geiger wrote:
>>
>> Works for me. What happens exactly? Do you get a 200?
>>
>
> That's exactly right - I always get a 200. How can I diagnose this?
>
Try getting the complete header by using curl -v http://url.com and
paste it here. In my example I'm getting this output:
* About to connect() to ****** port 80 (#0)
* Trying 213.***.***.***...
* Connected to ****** (213.***.***.***) port 80 (#0)
> GET /test.php HTTP/1.1
> User-Agent: curl/7.29.0
> Host: ******
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Date: Fri, 02 Aug 2013 14:27:15 GMT
< Server: Apache
< Content-Length: 6
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
* Closing connection 0
What is your output?
Regards
Karim
--
Karim Geiger
Auszubildender Fachinformatiker AE
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
Great tip, Karim!
On 02/08/13 15:29, Karim Geiger wrote:
Try getting the complete header by using curl -v http://url.com and
paste it here.
What is your output?
Here's my output:
$ curl -v http://localhost/header-test.php
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /header-test.php HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 02 Aug 2013 14:32:47 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.4.9-4ubuntu2.2
< Status: 500 Internal Server Error
< Vary: Accept-Encoding
< Content-Length: 0
< Content-Type: text/html
<
* Connection #0 to host localhost left intact
Using the following test script:
<?php
header('Status: 500 Internal Server Error');
header('HTTP/1.1 500 Internal Server Error', true, 500);
?>
--- End Message ---
--- Begin Message ---
Hi Miguel,
On 08/02/2013 04:34 PM, Miguel Guedes wrote:
>
> Here's my output:
>
> $ curl -v http://localhost/header-test.php
> * About to connect() to localhost port 80 (#0)
> * Trying 127.0.0.1...
> * Connected to localhost (127.0.0.1) port 80 (#0)
>> GET /header-test.php HTTP/1.1
>> User-Agent: curl/7.29.0
>> Host: localhost
>> Accept: */*
>>
> < HTTP/1.1 200 OK
> < Date: Fri, 02 Aug 2013 14:32:47 GMT
> < Server: Apache/2.2.22 (Ubuntu)
> < X-Powered-By: PHP/5.4.9-4ubuntu2.2
> < Status: 500 Internal Server Error
> < Vary: Accept-Encoding
> < Content-Length: 0
> < Content-Type: text/html
> <
> * Connection #0 to host localhost left intact
>
> Using the following test script:
>
> <?php
>
> header('Status: 500 Internal Server Error');
> header('HTTP/1.1 500 Internal Server Error', true, 500);
>
> ?>
allright, that's weird. I'm currently not able to reproduce your problem
but I've found out that some others are experiencing the same problem
like you do. They found this solution to work:
header($_SERVER["SERVER_PROTOCOL"] . 'HTTP/1.1 500 Internal Server Error');
Might try this one..
Regards
Karim
--
Karim Geiger
Auszubildender Fachinformatiker AE
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
This is strange. I've just found out that the headers are sent
correctly if I access the website outside of localhost. I don't
understand why.
--- End Message ---
--- Begin Message ---
OT
Anyone having internet troubles?
(also seems to be login database issues too at various places)
like...
http://forums.adobe.com/community/dreamweaver
and try to sign in on upper right
i get this
We're sorry, the site area you've requested is unavailable. Please try again
later.
and
- go to - http://bluehost.com
and try LIVE CHAT in mid page and it also fails...
i get
Our chat service is currently undergoing maintenance and will be back online
shortly. Call us (888) 401-4678 or open a ticket if you need further assistance.
and other issues too like
also
http://www.downdetector.com/status/time-warner-cable/los-angeles
Time Warner Cable Los Angeles reports
ugh! #twc #timewarnercable connectivity issues again, and apparently it's
effecting a lot of work from home coworkers..get it fixed!! — (@BloodBought3)
2013-08-02 07:37:59
--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]
--- End Message ---
--- Begin Message ---
O'Reilly has a free download, apparently through a company called SAVVIS. No
affiliation, just passing this along…
http://go.savvis.net/paas
You give them some contact info, and you get a download link. Nothing is
actually checked to see if the info you fill in is real or not.
(cross-posted: ruby-talk, rubyonrails-talk, php-general)
--- End Message ---