Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Larry last won the day on July 9

Larry had the most liked content!

Community Reputation

422 Excellent

About Larry

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. You should debug the query itself to start. See if the query is returning exactly one row or not. If not, then you need to debug it backwards to see if the problem is: The value of $e in the PHP script The value of email in the database If active has a null value in the database (not an empty value)
  2. Hello! First, just so you know, these forums aren't that active. I check them three days a week myself. So going forward you should assume it'll take at least a couple of days to get a reply. As for your specific issue, I've been working with PHP for 20 years now and I've never heard of that error before. What is the exact URL you're loading when you see that error and what is the exact error? Finally, do keep in mind that this book assumes solid comfort with PHP and MySQL and builds upon that knowledge to create a couple of advanced e-commerce applications. If you're not truly comfortable with both technologies, you may want to start with a different book first.
  3. It looks like the function is defined twice in the same file, starting on lines 28 and 33.
  4. Saving the file and placing it in the web directory is the same instruction I've used since page 4. There's only the one file.
  5. The differences between the two queries are pretty obvious but what's really important is: What's the users table definition look like? What error message, if any, is MySQL returning. The answer to the first might inform the second, but you ought to just look at the MySQL error directly. That's assuming there is an error. If there is no error then your query is syntactically fine, there's just no matching rows.
  6. You shouldn't be storing the user_id in both a cookie and a session. Figure out which approach you ought to be using--cookies or sessions--and just go with that one.
  7. Well, the error means that it cannot find the named file or directory, which either means the file or directory doesn't exist OR the file or directory path provided is wrong. Here it's the latter. Note that you start with /~saphiakhara That's probably wrong. In Unix, the tilde refers to the current user's home directory. So ~ in this case equals /Users/saphiakharaz. You have "/~saphiakhara" which is incorrect in a couple of ways. "~/ecom1/..." would be more correct but you should probably use the full, absolute path ("/Users/saphia...") instead.
  8. I don't know where those values are coming from! I'd just search through your code to see where you might have defined them more than once.
  9. Ah, okay. This is definitely do-able, but not simple. To start, you'll need a way of reflecting sizes for non-coffees. An option would be to replicate the coffee database structure. Note that if somethings might have multiple sizes and other things might not, you'll need to account for that. For the automatic price change, you'll need to use JavaScript. When the size selection changes, the JavaScript would fetch the information for that size from another PHP script (using an XHR request). Or you could do some sort of logic where the display PHP stores the new price as metadata on the menu and then the JavaScript parses that out. In either case, you'll need to use JavaScript. For the product details page, follow the specific coffees page as a model, passing along the specific product ID and then fetching it from the database. For the shopping cart with a sized product, just replicate what's being done with the coffees. Let me know if you have any more questions and good luck!
  10. Hmmm...this is the kind of thing that may change in different versions of MySQL. Nice work switching to using the + INTERVAL syntax, though!
  11. Could you confirm what the FULL URL is with Books & DVDs?
  12. Yeah, this looks like a UTF issue. I'd make sure you have all that squared away, both in the database definitions and in the connections. Switching to English only may work but it entirely defeats the purpose of what you're trying to do here!
  13. Try escaping the % sign. That's often the solution in situations like this, where a character may have special meaning.
  14. The table structure I have in my SQL file is CREATE TABLE `specific_coffees` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `general_coffee_id` tinyint(3) unsigned NOT NULL, `size_id` tinyint(3) unsigned NOT NULL, `caf_decaf` enum('caf','decaf') DEFAULT NULL, `ground_whole` enum('ground','whole') DEFAULT NULL, `price` decimal(5,2) unsigned NOT NULL, `stock` mediumint(8) unsigned NOT NULL DEFAULT '0', `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `general_coffee_id` (`general_coffee_id`), KEY `size` (`size_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; where specific_coffees has a size_id column.
  • Create New...