Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. You could do an isset($_FILES['mp4']['tmp_name']) first or just use the error suppression operator on the is_uploaded_file().
  2. This error is the cause of all, or most, of your problems: Warning: include(C:/xampp/htdocs/PHP/Chapter13/mysqli_connect.php): failed to open stream: No such file or directory in C:\xampp\htdocs\PHP\Chapter 13\add_quote.php on line 23 Your reference to include mysqli_connect.php from add_quote.php is incorrect based upon how the two files are found on the server.
  3. Ah, no, not exactly. The semicolon there terminates the line of PHP code. What I'm saying is you don't need to do this: $q = "SELECT user_id FROM users WHERE (email='$e' AND pass=SHA1('$p'));"; so that the query being run from the PHP script becomes SELECT user_id FROM users WHERE (email='$e' AND pass=SHA1('$p'));
  4. Hopefully there aren't any examples of queries in PHP scripts having terminating semicolons! Or, put another way, in MySQL you need to use a semicolon to indicate the end of the query to be executed. In PHP you don't need to do this.
  5. My guess would be the file isn't being uploaded. How big is the .mov file you're testing with? And have you checked your server settings related to handling uploads (such as the max POST size)?
  6. Ah, okay. So you're only having this problem when you click submit to update the information? If so, I think that's because of the extra spaces around the stored value here: value=" '. $id .' " If you look at the HTML source of the page you should see the value stored as " 1 ". I wouldn't think that would cause this problem but I suspect it is.
  7. Okay, so fundamentally the users table should identify the user and allow them to login (i.e., store login credentials). I wouldn't assign a single type in the users table b/c users don't have a single type in your scenario; they're type is defined by context. If you need to do something for or with a group of people--email all the parents, create teacher-specific pages--then you'll want to have an easy way to identify "is a teacher" or "is a parent" (but without limiting a user to being just one thing). My inclination would be to create three 1/0 TINYINTs: student, teacher, parent. A student would likely be 1, 0, 0 for those columns whereas a teacher would likely be 0, 1, 0 or 0, 1, 1. Using this approach you have flexibility as to how you refer to people or access lists of groups.
  8. More information is needed to answer this. Can the users log into the site? I presume a teacher could also be a parent but can a parent or a teacher also be a student? In general, the user as a concept is a way of identifying a person. A user may also be a way to identify functionality (e.g., log in). But the user's type in your case may not be a static, singular thing but rather be a description of the relationship that user has to another user (e.g., teacher A may teach student B but also be a parent to student C).
  9. And if you change your script to begin <?php echo $_GET['id']; exit; It would output 1?
  10. I am not seeing any obvious problem and it sounds like you've done all the due diligence. You're saying the page, when it loads, is edit_user.php?id=1 or whatever?
  11. Make sure you create the users table before you create the orders table.
  12. You're using single quotes when those should be backticks.
  13. Thanks for the nice words! As for #1, the code would be essentially the same as that creating the page titles (e.g., in browse.php and then header. html), just populating the META instead of the TITLE.
  14. Hmmm...so that's a different error than you had before and doesn't exactly make sense given the code above. What steps had you taken when you got this error?
  15. You should print out the query (the $sql) variable to see what the full query is. Sounds like you have a syntax error.
  16. Thanks for the interest in more books! Much appreciated! The "PHP Advanced" book would be the logical one after "PHP & MySQL". Or the e-commerce book that Necuima recommended.
  17. 1) You'd store the keywords in the database along with the product info. Then you'd retrieve the product details before including the header file, making those keywords available to the header file to put in a META tag. 2) You'd need to track the user's viewing history and then you can pull from there. So when a user views a product, that stores the product ID, user identifier, and timestamp in a table. When that same user identifier appears, you can pull the info from that table by date desc order.
  18. Ah, okay, that helps! Your function doesn't have access to the database connection so it can't execute the query. I would have thought it'd kick on the !$r error, though. But try passing $dbc to the function as an additional argument and see if it behaves better.
  19. In what way is it not working? Like what isn't it doing that it should be doing or what is it doing that it shouldn't be? What is the output? What debugging steps have you taken and what were the results?
  20. Sorry for the delay; I had to reinstall XAMPP on Windows to test this out. I suspect the issue you're having is because you haven't connected Mercury to the Internet at large. In other words, Mercury needs an SMTP server to work with. This is normally your local ISP or something like smtp.google.com (if you have a Gmail account). Have you done that? This page is pretty good, by the way: https://www.open-emr.org/wiki/index.php/Mercury_Mail_Configuration_in_Windows
  21. Ah, great! Glad you're making progress and thanks for letting us know! Just to be clear, you should never mix procedural and OOP approaches like that as you won't necessarily get the errror messages, let alone the results, you're looking for. As for your question, if a query must affect one or more rows, than checking for that is perfect. But if a query won't necessarily affect multiple rows than you can confirm that it worked--or that it didn't fail--by either checking the truthiness of the query result or by checking for the presence of an error.
  22. I don't know what the "paystack api" is but if it's a good API, it should have documentation and ideally support.
  23. It looks like you're mixing both procedural and OOP styles. You need to pick and use just one. I think that's why it's not working but the error results also aren't helpful.
×
×
  • Create New...