Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. This is just a note to say that I haven't officially created any "Review and Pursue" threads in this forum yet as I didn't know what, exactly, readers would want. So feel free to post your questions as you have them and I'll answer them as they come. In time I may then shuffle things around to create an organized "Review and Pursue" system. Thanks for your interest in the book!
  2. This forum is specific to the fourth edition of the book "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide", written by Larry Ullman and published by Peachpit Press published in September 2011 (ISBN 0-321-78407-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.
  3. Yes, it seems like .htaccess is working. I'd now change it to just this: <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^shop/sales/?$ sales.php # For the primary categories: RewriteRule ^shop/([A-Za-z\+]+)/?$ shop.php?type=$1 </IfModule> Then you can make sure that the sales and shop pages are working. As for that error, that's likely because your stored procedure isn't working. You'll need to apply the standard PHP-MySQL debugging techniques to determine why.
  4. Okay, then I think the next step is to confirm that .htaccess is working at all. I'd change the root .htaccess file to just this: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^test/$ index.php </IfModule> Then go to http://www.phppond.com/test/ That should take you to the index.php page. If not, then you'll need to talk to your hosting company about allowing for .htaccess overrides.
  5. Well, my reaction was based upon the theory that you knew something I did not (in this case, specifically about cURL). If it is true that there's an argument for using cURL for local files and if it is true that cURL is more secure, that's information I ought to know. I learn from these forums, too, so my questioning was in that regard. And, as already said, to ensure technical accuracy for the sake of the original poster and those that might read this thread. In terms of the strength of my reaction, I'll point out that I did not write anything along the lines of "HartleySan, I don't think that answer is going to help too much", which is the kind of statement you're prone to making when you disagree with a reply's approach.
  6. I see. Yes, cURL is quite excellent, but wouldn't be used here. Gotta try to keep these forums as accurate as possible; already too much misinformation online!
  7. Yes, abigail's exactly right (thanks!). The second loop reads the second row from the file and assigns it to $row. You could have used $row within the first while loop but before the second to access that first line. Of course, you actually don't want two loops anyway. Also understand that with that syntax, the first while loop is only executed once, because the inner while loop reads the rest of the file. Once that inner loop is done, the outer loop gets control again and has nothing left to read from the file.
  8. On the home page I see an error for including the mysql.inc.php script. Those links aren't working because of .htaccess problems. Do you have the .htaccess file in the root directory?
  9. HartleySan, would you really recommend using cURL to read through a text file on the same server as the PHP script? And in what ways is cURL more secure than using fopen(), fgets(), and fclose() for reading local files?
  10. The link you've posted does not work, which could be because of a problem with your .htaccess file. Still, if your files are in the html directory, then they're still in A subdirectory and your links won't work as written.
  11. Hey Lou, I think I can safely say I don't get tired of answering the same questions over and over, so long as they're coming from different people. If anything, I take that as an indication that I need to do my job better (i.e., make this more clear, emphasize that, etc.). I do get annoyed telling the same person the same thing over and over again. And, of course, a little humility is always good, as I've no doubt been one of those people a time or two, but perhaps in other areas.
  12. The echo wasn't causing the problem, however. The assignment of the string to $q was still taking place, and the echo was printing the results of that statement's execution, which would have been the string itself (as shown by the original poster). So while there's no reason to do echo $q = ..., that wouldn't affect the assignment of the query string to the $q variable.
  13. No need to apologize and you certainly didn't offend me. But, yes, I had thought this through and I hadn't discarded the idea without due consideration.
  14. Well, money aside, and what I could or could not afford, the first problem would be who to hire. Stuart would be great, sure, but so would many other people, including people in the past who aren't currently frequenting the forum. So making that choice would be tough and, more importantly, I'd run the risk of offending and/or driving off the other people that are helping. It means a lot to me that people, like yourself, help others here, but I think it's best done voluntarily. Second, if I were to pay someone to moderate the forums, I'd need to oversee them and I'd have certain expectations. If someone handles something poorly now, that's largely on them. If someone I'm paying handles something poorly, that's largely on me. Third, paying someone to moderate the forums becomes a disincentive for me to participate in the forums. And part of the point of the forums is that readers can get help from the writer here. Technical editors are paid by the publisher. And they need to be top-level experts on the particular subject (meaning the same person wouldn't be the tech editor on multiple books). There are certainly aspects of my job that could be managed by a paid assistant, but I'm not at a point yet where that's financially appropriate and I'd have to think more about what I need before pursuing that further.
  15. The template file is just a simple HTML template. You don't need it at all. You also don't need a database until much later in the book.
  16. HTTP is a stateless technology and this is still true for HTML5. The problem isn't in updating the database, that's quite easy to do and can be done without the user being aware of it (i.e., Ajax). The problem is in updating what is shown in one browser after the other user makes a choice in their browser. There is no way to push content onto a client's HTML page like that. The only workaround is to use Ajax to constantly ask if there is new content available, which is terribly inefficient and the end result will be clunky. For example, in a chess game, early moves might only take 15 seconds, so perhaps running an Ajax request every 15 seconds makes sense. But if a move takes 5 seconds, then there's an unnecessary 10 seconds of wait time. More importantly, if someone goes to the bathroom and the next move ends up taking 5 minutes, there are 19 unnecessary Ajax requests being made (39, if both clients are making requests). And what if you wanted to add live chatting, which would be a common feature on an online game? There's no way using HTML (with PHP as a backend), that you can do true live chatting. If Stanos wants to do this because that's something Stanos wants to do, I understand, but in my opinion, PHP/HTML is not the right choice of technologies for this particular application.
  17. Okay, for starters, I would definitely NOT uninstall and reinstall XAMPP every time you have a problem. The %3F is the entity version of the question mark. You need the actual question mark there. Chrome did not put the %3F there, but something did. Try using that same URL with a question mark instead of %3F. That should work. Then either the PHP code or your mail client is causing the problem.
  18. You need to use a loop to access every line. Another poster is trying a similar thing and what I've written there may be useful: http://www.larryullman.com/forums/index.php?/topic/589-how-to-identify-a-record-in-text-file-then-print-selected-values-of-that-record/page__fromsearch__1
  19. Hello John (I assume this is John), First of all, as I specifically said in my email yesterday, in which you asked about this question, when you post this message, please include the versions in use (e.g., PHP), and the actual code. No one can help debug code they can't see. As it stands, I have no idea what you mean about changing the argument from 'fb' to 'Fb', as the script I have (from the book) doesn't have 'fb' in it anywhere. Second, I would wonder why you would change 'fb' to 'Fb' and what you think you'd accomplish in doing so.
  20. It's always okay to share what you've learned. The problem is you have one while loop that calls fgets() and then an internal one that calls fgetscsv(). Apparently this wasn't clear from what I was saying. What I was saying is that you could use fgets() to go line by line, and then explode() within that loop, OR you could skip to the chase and use fgetscsv() in a while loop. So drop the fgets() while loop (which is reading in the first line, but not doing anything with it) and you should be fine.
  21. For what it's worth, and perhaps it's nothing, but in my opinion, PHP would not be a good choice for something like this. Whenever sites need real-time, dynamic interactions between two or more clients, a Java or Flash app is the common approach. It's certainly possible to do this using Ajax, but it's going to be clunky.
×
×
  • Create New...