Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Larry

  1. You don't say how it's not working but my guess is the problem is b/c you're hard-coding the PDF application type in there. The content-type header indicates to the browser what type of file to expect. If you say to expect a PDF but send a Word doc, that's not going to work.
  2. So the problem is that you're still viewing an HTTPS page when you don't have HTTPS enabled. I assume it's because of the .htaccess. Did you restart the web server after making the change?
  3. The newline affects the HTML source code of the page. It's visible there, not in the visual result rendered by the browser.
  4. Ah! Then if you haven't acquired a certificate, your HTTPS links won't work. Change them to HTTP. I wouldn't worry about a certificate for now--and certainly don't purchase one yet.
  5. If you're getting a 404, your PHP code is probably fine and it's the Apache configuration that's the problem. In other words, given this URL, Apache doesn't know what page to serve. It looks like your regular expressions are incorrect. You seem to be using the same matching pattern for all three conditions and that pattern doesn't match /our-furniture-test/beds/20/5/.
  6. I don't quite follow why you would print the same database value in three different radio buttons. Radio buttons are normally used to select one item from a group of items with different values. I also wouldn't use array syntax for the radio button name. You'd only want to do that for something like SELECT menus or checkboxes where multiple values can be selected or checked.
  7. First, to be clear, the behavior has nothing to do with DIVs (or PHP for that matter). It's simply how radio buttons work in HTML. I'm not quite following what you're trying to do, though. Maybe you should be using checkboxes instead? If you could explain the scenario in more detail I can give more specific advice.
  8. It's probably either a problem with your certificate or your server configuration. What operating system and web server are you running and how did you install and configure the certificate?
  9. Thanks for the nice words! As for this situation, first of all, congrats on the growth of your site! I've not done this particular thing before, but my inclination is to start by thinking about what variables would exist. You'd always have $current_page and $total_pages. I think I'd then add a $show variable, for the number of additional numbered links to show (e.g., 2 gets you 4 5 6 7 8). Then the logic becomes: If $total_pages is greater than some figure (maybe $show * 4?), don't loop through every page number. And then... If there's more than $show pages between 1 and $current_page, do "FIRST...". And also... If there's more than $show pages between $current_page and $total_pages, do "...LAST" I'm not sure if that's everything but off the top of my head that should get you going in the right direction! Let us know how it goes or if you have more questions!
  10. Thanks for the nice words on the book! I don't quite follow what your goal is here, however. Could you maybe start by explaining the end result you're working towards?
  11. Hey Hector! Thanks for the interest in the book and it's great that you have a target project in mind. The book does cover how to have multiple users with login/logout, so it'll give you the bones of what you want.
  12. Excellent. Kudos for figuring it out and thanks for sharing the solution!
  13. Thanks so much for the nice words. I really appreciate it. Kudos for figuring out the MySQL question! As for the redirect it sounds like you just have a bug in your code somewhere. Find the redirect line and see that you aren't adding an extra "http//" somewhere.
  14. That seems like you're on the right path. I'm not quite following what the problem is. You say it gives you an error when you do 0, but that seems like the correct behavior, no?
  15. Here is a somewhat similar example: https://github.com/LarryUllman/phpmysqlvqp-5ed/blob/master/ch11/show_image.php
  16. My inclination is since you're using stored procedures already, put as much logic into the stored procedures as you can. But if you do need the cart contents on this page, that's fine. I'm a little confused by this line, though: if ($row['users_id'] == '0') I'm not sure why you're quoting a number. Also, if there's no users_id for a cart, would that have a 0 value or a NULL value? I would think the latter, but it depends upon how you defined it.
  17. There's nothing obvious in the code that's wrong. You'll need to do some debugging here. Start by verifying that the stored procedure is being called. Then verify the values of the variables. Run the stored procedure using phpMyAdmin (or the mysql client) using those same variable values, etc. In short, you'll need to use lots of print statements, trial and error, here!
  18. The content-type would differ based upon the type of image. This is why I suggested using the mime_content_type() function to dynamically get the MIME type and then provide that dynamically in the code.
  19. Yes, you do need to change the content-type header. It ought to match the content type of the file (i.e., of the image). You can use the https://www.php.net/manual/en/function.mime-content-type.php function to get that from the actual file on the server.
  20. Unfortunately I don't know the answer to this one. Sorry!
  21. My guess is the MySQL user you're using from the PHP script doesn't have execute permissions to run the stored procedure.
  22. If you Google "htaccess force ssl" you'll come across articles that explain this, like this one: https://www.siteground.com/kb/how-to-force-ssl-with-htaccess/
  • Create New...