[PHP-DB] mysql/php time out issue
I'm running php 5.1.6 with mysql 5.0.45 on CentOS 5.3 box trying to loop through a while statement to send about 3000 email using phpmailer. It's worked well in the past but after an upgrade it seems to be timing out now after 200-300 emails over 1 minute or two. I've added set_time_limit(30) within the while loop to reset the time out. I've added a sleep(1) statement to throttle the program (I've tried sending with and without these additions). I've altered several config files to see if it would send to completion to no avail: mysql.connect_timeout = -1 memory_limit = 100M max_input_time = 60 max_input_time = 600 max_input_time = 0 and the following mysql config: key_buffer = 256M max_allowed_packet = 50M table_cache = 1024 sort_buffer_size = 1M read_buffer_size = 1M read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M thread_cache_size = 64 tmp_table_size = 40M join_buffer_size = 1M query_cache_limit = 12M query_cache_size= 32M query_cache_type = 1 max_connections = 60 thread_stack = 128K thread_concurrency = 4 Any where else I should be looking. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Echoing a variable within a variable.
I'm emailing an html file through phpmailer and the sql look up is getting the html from a table and setting it into a variable. Within the html from the table are also variables that are also being called by the same sql that is looking up the html variable. However the variable in the html are echoing as $var instead of the assigned value being called from the sql look-up Not sure what the solution is. Any thoughts. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Phpmailer sending duplicate messages...
It seems to be ccing each email to everyone and I'd like it to only include one email address with each email. I've tested in on three of my personal emails and I see to get six messages in my inbox. I'm also sending about 4000 emails and would like some pointers to avoid time out errors. Finally for the life of me can't figure out how to execute an insert statement to record a history of each email sent. When I include the insert statement, no emails are send. Following is the code. Any help or direction would be greatly appreciated. Thanks. ** ?php require(class.phpmailer.php); $mail = new PHPMailer(); include (cxnfile); $cxn = mysqli_connect($host,$user,$password,$database) or die (Couldn't connect to server); $query = select * From db where groupid = groupid; $result = mysqli_query($cxn,$query) or die(Couldn't execute select query.); while($row = mysqli_fetch_assoc($result)) { extract($row); $mail-IsSMTP(); $mail-Host = host.com; $mail-From = [EMAIL PROTECTED]; $mail-From = [EMAIL PROTECTED]; $mail-FromName = Company; $mail-AddAddress($email, $Contact); $mail-IsHTML(True); $mail-Subject = $Subject; $mail-Body = $PR; $mail-WordWrap = 50; if(!$mail-Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail-ErrorInfo; } else { echo 'Message has been sent.'; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Trouble with Text Area
When I put his line outside of the php tags I get the correct size: textarea name='name' value='$String' rows='10' cols='10'/textareap When I put this line inside the php tags the size comes out about 2 rows by 10 columns regardless of the value of rows and cols. Any ideas on how to format this would be greatly appreciated. The mySQL db column TYPE I am calling is Blob not null. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: backup of database record before update
Neil, Have you had success with triggers. I couldn't get one to work and then saw discussion on the board here that MYSQL triggers were not so reliable and still somewhat problematic so I archive through the application. Just curious. -Original Message- From: Neil Smith [MVP, Digital media] [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 30, 2007 3:16 PM To: php-db@lists.php.net Cc: Ronald Wiplinger Subject: [PHP-DB] Re: backup of database record before update At 06:57 28/10/2007, you wrote: Message-ID: [EMAIL PROTECTED] Date: Sun, 28 Oct 2007 14:56:12 +0800 From: Ronald Wiplinger [EMAIL PROTECTED] I need some hints how to do that. Maybe there is a template or an easy function available. I have a MySQL database with some tables. Everytime a table record changes, I want also put the old record to a history database. The history table and the original only differs that the key of the original will be just a field in the backup, while the new key is now the UNIX time stamp. How can I do that easy? Easy is to set a MySQL5 trigger which does the Insert on update : http://dev.mysql.com/doc/refman/5.0/en/triggers.html eg (from the manual page) : DELIMITER | CREATE TRIGGER testref BEFORE INSERT ON test1 FOR EACH ROW BEGIN INSERT INTO test2 SET a2 = NEW.a1; DELETE FROM test3 WHERE a3 = NEW.a1; UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1; END; | HTHCheers - Neil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Notice: A non well formed numeric value encountered
Thank you for your response. The notice is in the Subject Line of the email: Notice: A non well formed numeric value encountered So you are saying I have to convert the current -mm-dd:HH:MM:SS date format, to UNIX timestamp value then call Date() to format the UNIX timestamp as Month, Day, Year? If so, is it recommended to do that at the database level or the program level. I guess it would make sense to convert all dates to UNIX timestamp for database storage then convert at necessary. Any insight would be helpful. Thanks! -Original Message- From: Naintara [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 11:13 AM To: 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered I don't see the NOTICE message. Perhaps a timezone notice? Lookup the date() function in the php manual. The time parameter should be a unix timestamp value, so $CTS should contain an integer value. You can also find ways to convert the time value you have to unix timestamp, in the manual. -Original Message- From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 7:48 PM To: 'PHP-DB Mailing List' Subject: [PHP-DB] Notice: A non well formed numeric value encountered I'm getting the above NOTICE with the following statement: Echo date('d/m/y',$CTS); Where $CTS = 2007-09-22 10:09:31 And 31/12/69 is being echoed. PHP 5.2.1 MYSQL 5.0.37-community-nt via tcp/ip Thanks in advance for any insight. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Notice: A non well formed numeric value encountered
I have 3 Timestamp fields in a contact manager that record Edit date, Create Date and Merge Date. Doesn't matter to me how it is stored at this point however when I tried to call it up as just Month, Day, Year (with out the timestamp) in php I got the A non well formed numeric value encountered NOTICE. You say I can convert a mysql timestamp value at will in the program (which I think I am trying to do) and it is not working. Must I convert it with a MYSQL function or a PHP function. Any other ideas? -Original Message- From: Naintara [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 12:49 PM To: 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered That's a good question. I'm really not sure about which way is better, but yes, you could use UNIX_TIMESTAMP() to query a datetime value from a MySQL field, convert it to the UNIX timestamp value within the query, and then retrieve it in your record set. UNIX_TIMESTAMP() [MySQL function] Or you could use php to convert a datetime value to UNIX timestamp. mktime() [php function] You could store the timestamp value in the database itself, and convert at will in the program. So many choices... I really wouldn't know which to recommend, a lot depends on usage. The datetime column takes more storage than an integer column, but it's human-readable. If you mean storing an timestamp integer value in a particular database field, that should also be fine. There are a whole lot of issues with datetime related functions, like DST (daylight savings time) or timezones, if all that is critical, you may look into it. There is a TIMESTAMP field type in MySQL, the usage has changed in MySQL 4.1 and up. This is useful for recording time/date of db updates. For usual work, I find that a datetime data type column works for me. Then, if I know what I will be using the datetime value for, I sometimes format the date within the query itself using DATE_FORMAT() as I like to get the results that way rather than change it, of course, if you may be presenting the datetime value in different ways, or if you want the flexibility, then use php. I hope this helps somewhat. -Original Message- From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 9:24 PM To: 'Naintara'; 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered Thank you for your response. The notice is in the Subject Line of the email: Notice: A non well formed numeric value encountered So you are saying I have to convert the current -mm-dd:HH:MM:SS date format, to UNIX timestamp value then call Date() to format the UNIX timestamp as Month, Day, Year? If so, is it recommended to do that at the database level or the program level. I guess it would make sense to convert all dates to UNIX timestamp for database storage then convert at necessary. Any insight would be helpful. Thanks! -Original Message- From: Naintara [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 11:13 AM To: 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered I don't see the NOTICE message. Perhaps a timezone notice? Lookup the date() function in the php manual. The time parameter should be a unix timestamp value, so $CTS should contain an integer value. You can also find ways to convert the time value you have to unix timestamp, in the manual. -Original Message- From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 7:48 PM To: 'PHP-DB Mailing List' Subject: [PHP-DB] Notice: A non well formed numeric value encountered I'm getting the above NOTICE with the following statement: Echo date('d/m/y',$CTS); Where $CTS = 2007-09-22 10:09:31 And 31/12/69 is being echoed. PHP 5.2.1 MYSQL 5.0.37-community-nt via tcp/ip Thanks in advance for any insight. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Notice: A non well formed numeric value encountered
Naintara, That worked! I must have made a syntax error. Thank you! -Original Message- From: Naintara [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 1:34 PM To: 'Stephen Sunderlin' Cc: 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered I think for now you can use the MySQL function DATE_FORMAT() This would work well for your columns. Look it up in the MySQL reference, it's very easy to use. You'll have something like contact_created_date If a contact was created today, it'll be something like SELECT DATE_FORMAT(contact_created_date, '%M %d, %Y'); =September 22, 2007 Where contact_created_date is your field. -Original Message- From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 10:38 PM To: 'Naintara'; 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered I have 3 Timestamp fields in a contact manager that record Edit date, Create Date and Merge Date. Doesn't matter to me how it is stored at this point however when I tried to call it up as just Month, Day, Year (with out the timestamp) in php I got the A non well formed numeric value encountered NOTICE. You say I can convert a mysql timestamp value at will in the program (which I think I am trying to do) and it is not working. Must I convert it with a MYSQL function or a PHP function. Any other ideas? -Original Message- From: Naintara [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 12:49 PM To: 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered That's a good question. I'm really not sure about which way is better, but yes, you could use UNIX_TIMESTAMP() to query a datetime value from a MySQL field, convert it to the UNIX timestamp value within the query, and then retrieve it in your record set. UNIX_TIMESTAMP() [MySQL function] Or you could use php to convert a datetime value to UNIX timestamp. mktime() [php function] You could store the timestamp value in the database itself, and convert at will in the program. So many choices... I really wouldn't know which to recommend, a lot depends on usage. The datetime column takes more storage than an integer column, but it's human-readable. If you mean storing an timestamp integer value in a particular database field, that should also be fine. There are a whole lot of issues with datetime related functions, like DST (daylight savings time) or timezones, if all that is critical, you may look into it. There is a TIMESTAMP field type in MySQL, the usage has changed in MySQL 4.1 and up. This is useful for recording time/date of db updates. For usual work, I find that a datetime data type column works for me. Then, if I know what I will be using the datetime value for, I sometimes format the date within the query itself using DATE_FORMAT() as I like to get the results that way rather than change it, of course, if you may be presenting the datetime value in different ways, or if you want the flexibility, then use php. I hope this helps somewhat. -Original Message- From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 9:24 PM To: 'Naintara'; 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered Thank you for your response. The notice is in the Subject Line of the email: Notice: A non well formed numeric value encountered So you are saying I have to convert the current -mm-dd:HH:MM:SS date format, to UNIX timestamp value then call Date() to format the UNIX timestamp as Month, Day, Year? If so, is it recommended to do that at the database level or the program level. I guess it would make sense to convert all dates to UNIX timestamp for database storage then convert at necessary. Any insight would be helpful. Thanks! -Original Message- From: Naintara [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 11:13 AM To: 'PHP-DB Mailing List' Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered I don't see the NOTICE message. Perhaps a timezone notice? Lookup the date() function in the php manual. The time parameter should be a unix timestamp value, so $CTS should contain an integer value. You can also find ways to convert the time value you have to unix timestamp, in the manual. -Original Message- From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 7:48 PM To: 'PHP-DB Mailing List' Subject: [PHP-DB] Notice: A non well formed numeric value encountered I'm getting the above NOTICE with the following statement: Echo date('d/m/y',$CTS); Where $CTS = 2007-09-22 10:09:31 And 31/12/69 is being echoed. PHP 5.2.1 MYSQL 5.0.37-community-nt via tcp/ip Thanks in advance for any insight. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing