SV: [PHP-DB] new guy with stupid question
Well, that might, or might not be true. I dont use mysql, but in the manual for mssql_fetch_arry() you will find the exact same phrase. But in my experience mssql_fetch_row() IS significantly faster than mssql_fetch_array(). So you should definitely at least do a test, if you are at all interested in performance and user satisfaction. Regards Henrik Hornemann -Oprindelig meddelelse- Fra: Julien Bonastre [mailto:[EMAIL PROTECTED] Sendt: 21. januar 2006 06:08 Til: Jeffrey; php-db@lists.php.net Emne: Re: [PHP-DB] new guy with stupid question In reference to Jeffrey's comment about the performance of mysql_fetch_row vs mysql_fetch_array, which I always have used the _array implementation: From the horses mouth: Performance: An important thing to note is that using mysql_fetch_array() is not significantly slower than using mysql_fetch_row(), while it provides a significant added value [source: www.php.net/manual/en/function.mysql-fetch-array.php ] tata! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] new guy with stupid question
Hello, I am new to the list. I thought I would call my question stupid just to raise some eyebrows to those who might like to flame me for not reading some basic php/mysql books. Fact is - I have - I have been working with some scripts where I can change them and expand on them to suit my needs. I really don't think my question is stupid. It is just that time is of the essence and I am optimistic that I might make some friends to help me with some quick answers to get my scripts running. OK, sorry for the long winded info. For today I will ask for a script that will gather emails from the email field of a table in a database and send a news letter to those emails. How do I compose the email formatted with html for a professional look and send it to everyone in the database. If I haven't got myself kicked of this list yet, here is another basic question. I want users to be able to select a date for their schedule. I do not want them to have to follow the format of -mm-dd I just want them to select a month from a pulldown, then a day, and then a year. (I have all this set up all ready) What is confusing me is the part where I need to think out of the box a bit and combine there three selection into a date field. Like $month + $day + $year INSERT $month$day$year into $date; and come up with something that looks like 2006-08-13 I hope you know what I am trying to do here. Have I made any friends yet? Lonny -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new guy with stupid question
$date = $month.-.$day.-.$year; $query = INSERT INTO sometable (date) VALUES ('$date');; Hope this works for you, Aaron On 1/20/06, Lonny [EMAIL PROTECTED] wrote: Hello, I am new to the list. I thought I would call my question stupid just to raise some eyebrows to those who might like to flame me for not reading some basic php/mysql books. Fact is - I have - I have been working with some scripts where I can change them and expand on them to suit my needs. I really don't think my question is stupid. It is just that time is of the essence and I am optimistic that I might make some friends to help me with some quick answers to get my scripts running. OK, sorry for the long winded info. For today I will ask for a script that will gather emails from the email field of a table in a database and send a news letter to those emails. How do I compose the email formatted with html for a professional look and send it to everyone in the database. If I haven't got myself kicked of this list yet, here is another basic question. I want users to be able to select a date for their schedule. I do not want them to have to follow the format of -mm-dd I just want them to select a month from a pulldown, then a day, and then a year. (I have all this set up all ready) What is confusing me is the part where I need to think out of the box a bit and combine there three selection into a date field. Like $month + $day + $year INSERT $month$day$year into $date; and come up with something that looks like 2006-08-13 I hope you know what I am trying to do here. Have I made any friends yet? Lonny -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new guy with stupid question
Hi, Here's what I found googling around (with these keywords: html email php): http://www.sitepoint.com/article/advanced-email-php didn't read it through, but looks good imho (and there's more). And my apologies but I really don't understand your second question. :) Balazs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new guy with stupid question
Lonny wrote: OK, sorry for the long winded info. For today I will ask for a script that will gather emails from the email field of a table in a database and send a news letter to those emails. How do I compose the email formatted with html for a professional look and send it to everyone in the database. If I haven't got myself kicked of this list yet, here is another basic question. I want users to be able to select a date for their schedule. I do not want them to have to follow the format of -mm-dd I just want them to select a month from a pulldown, then a day, and then a year. (I have all this set up all ready) What is confusing me is the part where I need to think out of the box a bit and combine there three selection into a date field. Like $month + $day + $year INSERT $month$day$year into $date; and come up with something that looks like 2006-08-13 I hope you know what I am trying to do here. Have I made any friends yet? Lonny Lonny: Don't slag yourself off so much. That's what this list is for ;o) First question... $subject=Email subject line; $body=htmlNewsletter content/html; $return_address=From: [EMAIL PROTECTED]; $query=SELECT $email_address FROM some_table; $result=mysql_query($query) or die(Something went wrong, sweetheart: . mysql_error()); while($row=mysql_fetch_array($result)){ extract($row); mail($email,$subject,$body,$return_address); } Untested, but should work. And I know some of the people on the list will say that the mysql_fetch_array() is not the best approach - but you can fiddle with mysql_fetch_row() if you'd prefer. It would probably be a bit more efficient. As to HTML content for your newsletter, I would test first. Create a newsletter, send it to yourself and, if possible a couple of other people. Try various layouts until it looks right. But bear in mind that different e-mail clients are not consistent with the display of html content. So try as many different clients as you can, especially Outlook, Lotus Notes (if there are a lot of busness users), Thunderbird, Gmail, hotmail, etc. For what it's worth, I do a popular and highly regarded newsletter entirely in ASCII text. Of the over 2000 subscribers, only one person every complained about the appearance - and his complaints were such that it was clear he wasn't remotely interested in the actual content of the newsletter. For the last question, get the date info from your drop down menus, then in php... $date_for_db=$year.-.$month.-.$day; ...and insert $date_for_db into your table. Good luck, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new guy with stupid question
Hi, Aaron helped me to understand the question so here's an add-in to his comment. ?php if ($_SERVER['REQUEST_METHOD'] === 'GET') {//'GET' !== 'get' //display form (using POST method) } elseif ($_SERVER['REQUEST_METHOD'] === 'POST' isset($_POST['_non-optional_fields_']) is_numeric($_POST['_year_field_']) is_numeric($_POST['_month_field_']) is_numeric($_POST['_day_field_']) checkdate($_POST['_month_field_'], $_POST['_day_field_'], $_POST['_year_field_'])) { //process the form $date = $_POST['_year_field_'] . '-' . $_POST['_month_field_'] . '-' . $_POST['_day_field_']; $sqlInsertNewDate = INSERT INTO table_name (date_field) VALUES (' . $date . '); } else { //some error message or redirection here } ? from the MySQL manual: MySQL version through 4.1 accept certain illegal values for dates, such as '1999-11-31'. This is useful when you want to store a possibly incorrect value specified by a user (for example, in a web form) in the database for future processing. MySQL verifies only that the month is in the range from 0 to 12 and that the day is in the range from 0 to 31. that's why checkdate() is important. Hope it helped. Balazs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] new guy with stupid question
-Original Message- From: Lonny [mailto:[EMAIL PROTECTED] Sent: Friday, January 20, 2006 3:46 AM To: php-db@lists.php.net Subject: [PHP-DB] new guy with stupid question Hello, I am new to the list. I thought I would call my question stupid just to raise some eyebrows to those who might like to flame me for not reading some basic php/mysql books. Fact is - I have - I have been working with some scripts where I can change them and expand on them to suit my needs. I really don't think my question is stupid. It is just that time is of the essence and I am optimistic that I might make some friends to help me with some quick answers to get my scripts running. OK, sorry for the long winded info. For today I will ask for a script that will gather emails from the email field of a table in a database and send a news letter to those emails. How do I compose the email formatted with html for a professional look and send it to everyone in the database. If I haven't got myself kicked of this list yet, here is another basic question. I want users to be able to select a date for their schedule. I do not want them to have to follow the format of -mm-dd I just want them to select a month from a pulldown, then a day, and then a year. (I have all this set up all ready) What is confusing me is the part where I need to think out of the box a bit and combine there three selection into a date field. Like $month + $day + $year INSERT $month$day$year into $date; and come up with something that looks like 2006-08-13 I hope you know what I am trying to do here. Have I made any friends yet? Lonny -- 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] new guy with stupid question
In reference to Jeffrey's comment about the performance of mysql_fetch_row vs mysql_fetch_array, which I always have used the _array implementation: From the horses mouth: Performance: An important thing to note is that using mysql_fetch_array() is not significantly slower than using mysql_fetch_row(), while it provides a significant added value [source: www.php.net/manual/en/function.mysql-fetch-array.php ] tata! - Original Message - From: Jeffrey [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Friday, January 20, 2006 7:19 PM Subject: Re: [PHP-DB] new guy with stupid question Lonny wrote: OK, sorry for the long winded info. For today I will ask for a script that will gather emails from the email field of a table in a database and send a news letter to those emails. How do I compose the email formatted with html for a professional look and send it to everyone in the database. If I haven't got myself kicked of this list yet, here is another basic question. I want users to be able to select a date for their schedule. I do not want them to have to follow the format of -mm-dd I just want them to select a month from a pulldown, then a day, and then a year. (I have all this set up all ready) What is confusing me is the part where I need to think out of the box a bit and combine there three selection into a date field. Like $month + $day + $year INSERT $month$day$year into $date; and come up with something that looks like 2006-08-13 I hope you know what I am trying to do here. Have I made any friends yet? Lonny Lonny: Don't slag yourself off so much. That's what this list is for ;o) First question... $subject=Email subject line; $body=htmlNewsletter content/html; $return_address=From: [EMAIL PROTECTED]; $query=SELECT $email_address FROM some_table; $result=mysql_query($query) or die(Something went wrong, sweetheart: . mysql_error()); while($row=mysql_fetch_array($result)){ extract($row); mail($email,$subject,$body,$return_address); } Untested, but should work. And I know some of the people on the list will say that the mysql_fetch_array() is not the best approach - but you can fiddle with mysql_fetch_row() if you'd prefer. It would probably be a bit more efficient. As to HTML content for your newsletter, I would test first. Create a newsletter, send it to yourself and, if possible a couple of other people. Try various layouts until it looks right. But bear in mind that different e-mail clients are not consistent with the display of html content. So try as many different clients as you can, especially Outlook, Lotus Notes (if there are a lot of busness users), Thunderbird, Gmail, hotmail, etc. For what it's worth, I do a popular and highly regarded newsletter entirely in ASCII text. Of the over 2000 subscribers, only one person every complained about the appearance - and his complaints were such that it was clear he wasn't remotely interested in the actual content of the newsletter. For the last question, get the date info from your drop down menus, then in php... $date_for_db=$year.-.$month.-.$day; ...and insert $date_for_db into your table. Good luck, Jeffrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/235 - Release Date: 19/01/2006 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php