Jump to content
Larry Ullman's Book Forums

cantera25

Members
  • Content Count

    9
  • Joined

  • Last visited

  • Days Won

    1

cantera25 last won the day on May 12 2011

cantera25 had the most liked content!

Community Reputation

1 Neutral

About cantera25

  • Rank
    Newbie
  1. Thanks for the quick reply. That's my opinion as well - it seems like it would be extremely rare to switch database systems for a site that's already been developed. There are four main considerations I have for choosing whether to focus my studies on MySQLi or PDO: 1. Performance. I've seen a few benchmarks that show MySQLi is faster than PDO. Advantage: MySQLi 2. Employability: I'd rather master the approach that's most likely to keep me employed. Advantage: Don't know 3. Scalability: If the field is gradually moving toward standardizing on PDO, I'd just assume make it my standard as well. Advantage: PDO 4. OOP: I had assumed the choice between MySQLi vs. PDO came down to procedural vs. OOP. However, after reading further, it doesn't seem this straightforward. Advantage: Don't know Any thoughts on these or other considerations from anyone?
  2. Hi Larry - do you have a recommendation for whether it's better to use PDO vs. MySQLi for working with databases in PHP? It looks like you go exclusively with MySQLi in your books and in fact don't mention PDO at all. Do you consider MySQLi best practice, and if so, is that the case for both procedural and object-oriented programming?
  3. Thanks Larry - I was able to use your starter code and solve this incremental step. Much appreciated. By the way, I just finished reading your most recent newsletter. You mentioned the newsletters require a significant time investment - just wanted to say I find them really valuable, especially this issue's article on PEAR. I highly recommend the newsletter to anyone who's not already subscribed.
  4. As a follow-up to solving this problem incrementally, I'm trying to create a simple list of books by category: JavaScript JavaScript Patterns Object Oriented JavaScript Ajax Ajax Definitive Guide Building a Website with Ajax jQuery jQuery Cookbook Learning jQuery 1.3 I'm comfortable with the data structure and the SQL query: BOOK: book_id, book_title, fk_category_id CATEGORY: category_id, category_name SELECT category.category_name, book.book_title FROM category LEFT OUTER JOIN book ON category.category_id = book.fk_category_id ORDER BY category.category_name; -- My problem is that I don't know how to write the PHP script to list the books under each category header. I know enough to get the result set into an array, but then I'm stumped on using that array to group the items as shown. This seems like a pretty basic issue, but I'm having trouble finding an example that solves this. Has anyone here done this or seen a tutorial that explains how to do it?
  5. Glad to hear I might be on the right track (with my thinking at least). Regarding output, I'd prefer to view everything at once. Right now I'm taking two approaches to trying to solve this: 1. Starting in the "middle," I'm writing a big array in PHP modeled after the hierarchy in my original post. From there, I will a.) work out the PHP logic to traverse the array and display the hierarchy, and b.) figure out the database queries that can produce the array. 2. Starting incrementally, I'm trying to simply list all of the categories alphabetically with the book titles underneath. Even this has me stumped, however, and searching for "list items by category in php" surprisingly turns up very little (both on the web and in the literature). To get me started, I'm trying to adapt your To-Do List application in Chapter 1. Thanks again for looking into this -
  6. Thanks Larry - this is strictly for me, definitely not something I'm being paid to code. I'm a beginner struggling to make the jump from theory to practice and, almost invariably, it's this "categorical hierarchy" problem that keeps tripping me up. My current state of thinking is that recursion isn't the answer. It seems like if I structure the data properly and get SQL to return the right arrays, I can solve this more simply and elegantly using only array functions. My hope is that PHP shouldn't care about adjacency or paths or vertices -- instead, it should just check the tables for specific id's and return the corresponding lists as instructed. (Full disclosure: I was pointed to Directed Acyclic Graphs as the solution to my problem, and my brain started leaking. So I may be hastily wishing for a simpler answer.)
  7. Larry - thanks for your excellent section on recursive functions, I found it really valuable. I'm trying to go one step further -- where items can have multiple parents -- and could really use your help. As an example, I'd like to create a list of technology books by category, where each book can belong to more than one category -- and each category can be both a parent category and a sub-category. Here's an illustration: JavaScript - JavaScript Patterns - Object-Oriented JavaScript Ajax - Ajax Definitive Guide - Building a Website with Ajax jQuery - Learning jQuery 1.3 - PHP jQuery Cookbook PHP - PHP 5 Advanced - PHP jQuery Cookbook Ajax - Ajax Definitive Guide - Building a Website with Ajax XML - XML Hacks - No-Nonsense XML As you can see: - The book "PHP jQuery Cookbook" belongs to two categories: PHP and jQuery - The category "Ajax" is both a child of JavaScript and a parent of XML (but XML isn't a child of JavaScript) I've designed the database tables this way: BOOK: book_id, book_title CATEGORY: category_id, category_name BOOK_CATEGORY: book_id, category_id CATEGORY_TREE: parent_category_id, child_category_id Solving this has become a 'white whale' for me, and I'd really appreciate your help. Have you ever seen or written a tutorial on how to handle a scenario like this? Thanks!
  8. Floydian and/or Larry - while we're waiting for Larry's new edition, can you suggest a PHP book that does effectively cover 5.3 style OOP features and namespaces? Thanks!
×
×
  • Create New...