Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Posts posted by Larry

  1. Interesting question. Two options in my mind. One, just create four season columns in the database with the price for each season set. Then you'd use PHP to compare the chosen dates against the season dates (i.e., the definition of a season would be written into PHP). And the PHP code could decide how to handle a straddler.

     

    Or you could create a table that stores date ranges and prices (so X records for X seasons per year). You'd then need to use some logic in PHP to get the dates for multiple seasons and apply the right rates.

  2. Hey Floydian. Always good to hear from you. Huge congrats on the weight loss. 145lbs? That's insane. I'm jealous of your ability to get to the gym. I've got so little time.

     

    Thanks for the post and drop by any time! And keep up the good work (outs)!

  3. well, I got brands.php to display images for items taken from database OK, my brands.php is in site root directory along with browse.php, everything seems to be working up to the moment when I am passing 'category' and 'id' to browse.php. This is for some reason do not work. I spent last 9 hrs trying to figure out why it is not working, could you (please,please,please) look at my code?

    regards

    Zory

     

    I can look at your code. However, as I've said twice now in this post, I don't think the problem is in the code but rather in your directory structure and URLs. Neither of which have you provided yet.

     

     

    Hi Larry,

    Thank you very much for your reply. I need your further help on the same problem.

     

    Per your advice, 1)I checked the directory structure in my computer, it's the same layout as Figure 7.5 at page 173 (htdocs/physical_product folder/images folder or products folder.)

     

    2)i added RewriteBase /physical_product/ in .htaccess file, and index.php in firefox browser looks normal.

     

    3) i've tried to change references(from /something to /physical_products/somethingas you suggested) shown below, but the browser reads: Object not found in coffee page:

     

  4. Coffee
  5.  

    What else can i try to overcome the structure problem?

     

    If your directory structure is the same as that in the book, that's great, but your directory structure is not the same as in the book. In the book the files are in the Web root directory (htdocs), but you've placed everything within a subdirectory. This is fine, too, but you have to change all references accordingly. For example, the link to ./physical_product/shop/coffee is incorrect. The initial period means the link is relative to the current page, which won't often be the case. What you want instead is /physical_product/shop/coffee (as I wrote before), where the initial / means to start in the Web root directory.

  6. First of all, thanks for the great book!

    Thanks!

     

    Second and more general question to this topic:

    Do you consider it a better way to switch a DB entirely to utf8 (if I need/want it in some columns), or to chose a collation like latin1_german1_ci in general and utf8 on specific columns?

     

    I myself would say: use utf8 wherever possible because it is the future, isn't it??

     

    It sounds like you're confusing the topics of character sets and collations. I would generally use UTF8 as my character set for all tables and columns. I would also set the proper collation for all tables and columns. You can then adjust the collation (but less likely the character) set on a column by column basis.

     

    Simply writing this post helped me understand better ... (as so very often) So I'm giving some answers by myself:

    Kudos and thanks for adding your own solution.

     

    Why do you (Larry) use a column "pass CHAR(40) NOT NULL" in the users table which is utf8 encoded (page 446 in chapter 15: Message Board)? Didn't you mention that using CHAR() wasn't a good idea in utf8 encoded columns?

    Yeah, that's a minor point. For performance reasons, the recommendation is not to use fixed text columns with UTF8. But for performance reasons, something like an encrypted password, that will always be a set length, should be a CHAR. And, of course, MySQL will change the column's definition to what it thinks it should be. So the answer is...maybe, maybe not!

  7. First, thanks for posting all the key information. Much appreciated. The cause of the problem is the directory structure. You say that the images and products folders are in the root directory, but are they really? Or are they in the physical_products directory (per your URL)? If it's the latter, then you need to change references in the header from /something to /physical_products/something. You'll also need to set a RewriteBase in the .htaccess file, just after turning the RewriteEngine on:

    RewriteBase /physical_products/

  8. Hey Jonathon,

     

    Thanks for the words on the forum. As for Net_Geo, I'm a little confused. There's Net_Geo, which I used in the book, whose current version is 1.0.5. And there's Net_GeoIP, whose current version is 1.0.0RC3 (beta). Based upon the directory structure you originally indicated (Net/GeoIP.php), it looks like you installed Net_GeoIP, although I'm not sure where you get version 1.3 and that 2006 date from. Based upon the directory structure you indicate in this follow up post (Net/Geo.php), that's Net_Geo. So the first thing you'll need to do is pick one and go with it. If you want to match the book's instructions, use Net_Geo. If you want to use Net_GeoIP, see the PEAR documentation for that class.

  9. Hello Steve,

     

    Thanks for your question. I looked at the article and I'll admit that there are a few points made in the article that I disagree with (e.g., the argument to use mysql_pconnect() or the failure to confirm that variables are set before referencing them). I also don't think the author convinced me of the merits of addcslashes() over mysql_real_escape_string(). The argument for mysql_real_escape_string() is twofold: first, it puts more functionality into the database, which is generally advised. Second, it performs the escaping in a way that's particular to the character set used by the database, so it's more particular and less generic than addcslashes(). Also, to be clear, the author isn't using addcslashes() AND mysql_real_escape_string() but rather addcslashes() INSTEAD OF mysql_real_escape_string().

     

    To be clear, it's really a minor distinction between the two, but I prefer mysql_real_escape_string().

  10. This forum is specific to the fourth edition of the book "PHP for the Web: Visual QuickStart Guide", written by Larry Ullman and published by Peachpit Press published in March 2011 (ISBN 0-321-73345-2). If your question pertains to something specifically written in the book, including a particular script or bit of code, please make sure you're posting in the forum for the correct edition.

     

    If your question is not related to any book, that's fine, too.

    phpvqs4.jpg

  11. This forum is specific to the third edition of the book "PHP for the Web: Visual QuickStart Guide", written by Larry Ullman and published by Peachpit Press published in December 2008 (ISBN 0-321-44249-0). If your question pertains to something specifically written in the book, including a particular script or bit of code, please make sure you're posting in the forum for the correct edition.

     

    If your question is not related to any book, that's fine, but I would recommend you post your question in the forum for the most current edition of this book, which will be the most active.

    phpvqs3.png

  12. This forum is specific to the second edition of the book "PHP for the World Wide Web: Visual QuickStart Guide", written by Larry Ullman and published by Peachpit Press published in February 2004 (ISBN 0-321-24565-2). If your question pertains to something specifically written in the book, including a particular script or bit of code, please make sure you're posting in the forum for the correct edition.

     

    If your question is not related to any book, that's fine, but I would recommend you post your question in the forum for the most current edition of this book, which will be the most active.

    phpvqs2.gif

  13. This forum is specific to the first edition of the book "PHP for the World Wide Web: Visual QuickStart Guide", written by Larry Ullman and published by Peachpit Press published in April 2001 (ISBN 0-201-72787-0). If your question pertains to something specifically written in the book, including a particular script or bit of code, please make sure you're posting in the forum for the correct edition.

     

    If your question is not related to any book, that's fine, but I would recommend you post your question in the forum for the most current edition of this book, which will be the most active.

    phpvqs.jpg

  14. This forum is specific to the second edition of the book "PHP Advanced: Visual QuickPro Guide", written by Larry Ullman and published by Peachpit Press published in March 2007 (ISBN 0-321-37601-3). If your question pertains to something specifically written in the book, including a particular script or bit of code, please make sure you're posting in the forum for the correct edition.

     

    If your question is not related to any book, that's fine, too.

    phpvqp2.jpg

×
×
  • Create New...