Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by justsomeguy

  1. Redirect after you process the form.
  2. What do you mean? Web servers don't "want" to do anything, they simply do what they are told to do. What specifically are you seeing? Are you sure that your issue is related to PHP? .NET is the only platform that uses the term "postback" to describe a common behavior.
  3. Right, and can you pass the exercise at the bottom of that page? It's just showing how to build a select query. That's what you need to do. You're not doing it correctly.
  4. I wouldn't say it's "useless," but you're going to end up with a SQL query that has a syntax error in it. Just look at what the query is going to be after you do that.
  5. That part of the query is fine, it's the part that follows where you add errors.
  6. What? If any arbitrary line of code works on a page that displays shopping cart information, then the same line of code belongs in any other page that uses the database? OK, if you say so. You're the programmer. Of course not, look at the SQL query you're trying to build. It's not a valid SQL query.
  7. That's right, you have a syntax error in that PHP code, and I also questioned why you were treating $_SESSION['user_id'] as an array when that doesn't seem like it would be an array. And, whether or not that foreach loop runs at all, the SQL query is also going to have a syntax error in it. If that IS an array, and let's say it has 2 values, then you've built a SQL query that looks like this: SELECT * FROM forum WHERE user_id IN (0, 1 That's not right. If it's not an array, or an empty array, then this is your SQL query: SELECT * FROM forum WHERE user_id IN ( That'
  8. It's required if you need it, as the programmer. That's your job to figure out, you're the programmer. It doesn't matter that it's a "user", the database does not distinguish between the different "objects" that you try to store in the database. What the records mean to you does not matter, it does not change how to retrieve them. Every table in the database holds records, and getting records from a database table is the exact same regardless of what you've decided to name the table or the fields. You still use a select query. There's not a particular unique query for "getting
  9. Yeah, I see that. Why did you do that? What does adding an item to a shopping cart have to do with displaying a forum? You've added a PHP syntax error and there's also going to be a SQL syntax error in that code, so none of that is going to run. Displaying records from a single database table is pretty easy, that's not something complex enough that you need to copy some other piece of unrelated code and try to change it. The changes don't make sense, you're trying to loop through $_SESSION['user_id'] like it's an array. Why would that be an array? That doesn't make sense. None of this
  10. I'm not sure if browsers have a way to disable the developer tools or the console specifically. Probably not, because if so then any code that tries to use the console would be a fatal error and the code would stop running.
  11. It sounds like you have something that is confused about your code and thinks that the string inside your Javascript code is actually HTML code instead of a Javascript string. The bug is in whatever is giving you that message, assuming the rest of your HTML code is structured correctly (e.g., that Javascript code is inside a script element).
  12. What exactly is that code supposed to do? You're saying that code is for posting a new comment?
  13. If not even that first console.log works then it sounds like it's not running at all. If the first alert works but not console.log and not the second alert, maybe the browser that you're using does not have console.log defined.
  14. That O'Reilly book seems pretty good, 400-odd pages is about what I expect for an intro to PHP, and the reviews are generally positive. There are higher-ranked O'Reilly PHP books, but many of them deal with additional technologies like MySQL and Javascript, not just PHP. I would stay away from Amazon's #1 book in PHP programming though, which is the Kindle edition of "The Super Easy Sous Vide Cookbook: 575 Best Sous Vide Recipes of All Time".
  15. That code is from a book? Yeah, that's kind of crap, they don't bother to check the error code for the uploaded file and they're trying to use the try/catch block that is pointless. Which book did I suggest? I normally only suggest recent O'Reilly books, which I expect to contain decent code given their reputation.
  16. I'm not familiar with that specific book, I don't know if I remarked on specific code examples or if I was commenting on the particular code you were posting here. I don't have an opinion on the specific book.
  17. Then you 1) didn't do it correctly, or 2) didn't notice a different basic syntax error. I pointed out multiple syntax errors, and the presence of any one of them, again, will cause the entire thing to break. So, did you fix all of them? Did you fix the braces correctly? I don't know, and if you don't know either then that's a problem. Because in the most recent code you posted, you definitely did not, and for some reason you're still trying to use a try/catch block. Which I have no idea why. And I've told you this. This whole thing is like someone who refuses to learn the basics ab
  18. The report links are the major way to get in touch with the staff, I'm not sure what their policy is about responding though, if they have a policy.
  19. Yeah, there's nothing more that I can add. You have several books about PHP but you've never started at the beginning, you always try to jump ahead to something that you're trying to do. Maybe after a couple years of trying and failing you'll realize that doing that was not a good idea. There's nothing else to add, if you don't understand the basics you won't be able to do anything, and I don't understand your reluctance to just read from the beginning and make sure you understand everything. I really hope it's not an issue of you not wanting to spend the time to do that, because you have
  20. You can do whatever you want to do in the showError function, it will get called if there's an error.
  21. There's not enough information to help you. You have a for loop there where you keep inserting the same thing, but I don't know what data is being submitted to the page.
  22. Because one of them runs in the web browser, and one of them runs on the web server. The web browser does not have console access to the web server.
  23. What code are you running on the page that scrolls? The answer is in there somewhere.
  24. Everything that the browser submits is a string, there is no data type information that gets submitted. It it just a name, and a string value.
  • Create New...