Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

Everything posted by cNickerson

  1. Hello, I have the 3rd and 4th edition. I like to browse through new edition to see what Larry has updated. What has changed in the 5th edition? Does it cover some OOP? Does it cover PDO for MySQL?
  2. I may add you only need to add tax to purchases from same state. If the person lives in a different state than you you do not need to add sales tax. If you only have locations in one state you can just add thst % to sale if their shipping address is same as your state. Say you are in Massachusetts and you have a 2.5% sales tax. IF ( $shipping_address_state == 'MA' ) { $tax_rate = 0.025; // move decimal 2 places to left. $sub_total = $100.00; // total price of order. $tax_total = $sub_total * $tax_rate; // total amount of tax. $order_total = $sub_total + $tax_total; // total price including tax. }
  3. Hi Larry I noticed you have a new version of PHP for the web coming out! Will there be anything new you cover in the latest edition?
  4. I was wondering, what would be the best method for having users select their timezone? Obviously you cannot do a drop down list with each timezone such as "America/New_York" as there would be HUNDREDS of options for them to scrolls through. I just got my copy of the book today and reading through it I couldn't find a method for having users select their timezone. I noticed on # Script 17.5 - read.php, it shows how to convert timezones, however it doesn't show how users can select their timezone. Wanted to add this which I've seen around: EDIT 1: http://pellepim.bitbucket.org/jstz/ JavaScript that automatically detects timezones. I'm pretty sure that major websites that display times correctly without a user registering or setting a timezone use something similar to this. I just don't know how to use it with PHP/MySQL. EDIT 2: If not using automatic detection, the best way to display the timezones to people would be through your standard drop-down select box with GMT +12 through GMT -12. However I wouldn't know what to assign the values. Could you do this. <select name="timezone"> <option name="America/New_York">(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option> </select> The only problem is, will every location in the Eastern Standard Timezone have the same time as New York City? The whole Daylight Savings Time throws a huge wrench in the gears on this issue... EDIT 3: Checked current time in New York (5:27 PM) and Bogota (4:27 PM). Daylight Savings Time does mess it up,
  5. Thanks Larry. I already have this book "PHP 6 and MySQL 5" and "PHP 5 Advanced". Will order "PHP and MySQL for Dynamic Websites(4th edition)" and "PHP Advanced and Object-Oriented Programming(3rd edition)". You don't plan to release a new edition on either of these soon do you? Seems like right after I purchased the 3rd edition you released 4th one a month later. Bad timing. I noticed last edition was 2011, not sure if you are releasing a newer edition any time soon.
  6. Is it covered in the latest version? Also is the latest version in OOP? seems like most coding is now in PHP. Thanks Larry.
  7. Been a while since I read the book but I was going through it again and cannot find any info on PHP DateTime. I was having a problem with timestamps not displaying the correct time using the example below. The problem is Daylight Savings Time is currently in effect and is causing the time to be off by an hour. I had asked others and they said to use DateTime. I tried reading the php.net manual but it is very confusing and doesn't have any good examples of how to get a current time stamp and then adjust to a users timezone. Am I missing a part of the book that explains DateTime? <?php date_default_timezone_set("UTC"); $timezone = -5.0; $timestamp = time(); $local_time = $timezone * 3600 + $timestamp; echo date( "m/d/Y - h:i A", $local_time ); ?>
  • Create New...