Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Content Count

    5329
  • Joined

  • Last visited

  • Days Won

    147

Larry last won the day on September 23

Larry had the most liked content!

Community Reputation

428 Excellent

About Larry

  • Rank
    Administrator/Writer

Recent Profile Visitors

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

  1. Okay, so the code is the same as in the book and the library is roughly the same and the code examples in GitHub are roughly the same. This is going to be hard to debug! My inclination is that either the library doesn't work on HTTP or it has something to do with the sandbox. I would first log into Authorize.net and see if I can view the requests being made. First check that the requests are getting there. Then, if so, check that the requests are receiving the CC dummy values.
  2. Hmmm...it's been a long while since I've looked at this code. What version of the Authorize.NET PHP library are you using? This could be a change in their library since the book was written.
  3. Hmmm...this can be tricky. I'd start by re-evaluating whether it's really necessary to enable SSL on your Mac. Eventually I stopped bothering (I was never using real data that needed to be protected and since it's localhost, the data isn't leaving my computer regardless). But if you do want to continue the first trick is to figure out exactly why Apache doesn't like those settings. I normally start with Apache's "configtest" command, but you'll need to run that using MAMP's Apache. For the Mac's primary Apache you'd run `apachectl configtest`. Unfortunately I don't know what the properly
  4. Unfortunately I'm not familiar with VSC 2019 and its PHP support. Or what it means to Live View a PHP file in it. Hopefully someone else might know and post an answer, or an internet search turns up the solution.
  5. Hey Vikky! To implement a coupon system, you'd want to start by creating a coupon table. A coupon would have a code, probably an expiration date, and then either be a percent off or a fixed-amount off. In more sophisticated systems, coupons may only apply to certain items or total order amount, etc. You may also want to track coupon usage. Then, as part of the checkout process, you'd need to add a field to accept a coupon. Your programming logic would need to verify that the coupon is valid, and adjust the order total accordingly. You'd want to update your orders table in the database to
  6. Hey! You're having this problem because PHP runs on the server, which means all of your PHP code has already been executed before you see the HTML page in the browser. Secondarily, your button as written doesn't actually do anything. There's no programming logic attached to it. That would require JavaScript, which runs in the client.
  7. Good question! First, I guess I'd say that if having too many database records might be a problem, you probably want to rethink your hosting situation. The space used by fake records should be one of the furthest things from your mind, ideally. I imagine my forums has 1,000-2,000 fake registrations. That being said, you can just run delete queries to remove fake registrations on a manual schedule of your choosing. But it's probably worth trying to implement a couple of things to prevent fake registrations in the first place (reCAPTCHA and then some).
  8. Thanks for your questions and for your interest in the book. I appreciate it! Yes, I think the 5th edition would still be a fine way to learn PHP. It was written using PHP 7.0.6. The current stable version is 7.4.11. I'm not aware of any deprecated code, but I also haven't written a guide for that. Most of the feature changes that have come along are in the more advanced and esoteric areas of the language. Yes, this book is designed to be an entry into the PHP and MySQL book. Yes, forum posts can be pinned to the top of the list. Let me know if you have any additional q
  9. Okay, I think you should be able to do something like $(this).parent().prev().text(); Or it may be parent(). parent(). You can experiment with manipulating the DOM in the browser's console window to get the right solution. All that being said, if you have a form whose values are going into a database, I'm not quite following what the benefit is of updating an HTML table, too. The form selections already indicate what the user wants. You probably have a good reason--or I may be missing something--but I just wanted to raise the question.
  10. It's probably help if you could share that part of the DOM here so we could understand how you might navigate it.
  11. You probably want to be using $('#hway').text(returnval); as the DIV doesn't have a "value".
  12. I would always promote the benefits of walking away and returning when it starts to get muddled. Absolutely move on in the book and then come back to this in a bit!
  13. I wouldn't create multiple $color_ variables. Just create and use one $color variable.
  14. Ah, okay. So $phpvqs et al. represent their own indexed arrays, which means that indexing $phpvqs at 'PHP VQS' in the main array is the same as if you defined that sub-array there. Or put another way, imagine $phpvqs was equal to 2. Then $books['PHP VQS'] would also be 2. As for the actual variables $title and $chapters, those are named and created within the foreach loop to represent the index and the value at that index. These could be named anything--$k (or $key) and $v (or $value) are also commonly used. So the foreach loop doesn't "know" anything about the structure of the inn
  15. I'm sorry, but I'm not quite following what your exact question is here. On a cursory glance, your code looks correct. Is something not working properly? If so, how?
×
×
  • Create New...