Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Posts posted by benanamen

  1. 1. Stop with the random use of curly braces. Just use them always.

    2. Get rid of the redundant submit check. You should be checking the REQUEST METHOD anyways. Checking for submit can fail in certain cases.

    3. Stop creating variables for nothing.

    4. The errors should go in an errors array.

    5. Your code gives a success message for submitting an empty form. That makes no sense.

    6. There is nothing that stops the DB insert since you do nothing with the errors.

  2. 1 hour ago, ginerjm said:

    for sure you have to sanitize it to avoid damage to your database or whatever your script is doing with the data. 

    That's what prepared statements are for. Although, you would VALIDATE the data.

  3. Your second post has absolutely nothing to do with your first post. You really should have created a new thread. A simple google search on using LIKE would have easily answered your question. I guess you didn't read the page I posted the link to.

  4. There is much that could be said about this code, but to keep on point, you need to use Dependency Injection and pass an instance of the helper class to your user class just like you did with the PDO connection.

    * The duplicate query should be one of the first clues of a problem with this class.

     

    Quote
    
    // The start of going from procedural to OOP

    This pretty much explains what I see here so the current state of the code makes sense for now. You should eventually end up with quite a bit of refactoring when you get it dialed in.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.