Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. I dont see a thing about a subscribed value or a sub field or any function. I have no idea what your doing.
  2. What exactly are you trying to accomplish, and I don't mean how you think you need to do something. What is the overall task at hand?
  3. You can toss all that code. You are using obsolete code that has been completely removed from PHP. Go to this PDO tutorial and start from there. https://phpdelusions.net/pdo
  4. How about that. I thought the date/time functions only worked on a datetime column. Learned something new today. I would like to know if there is some instance where having the date in that format in varchar will not work with some functions. Must be some reason for the date column type.
  5. If you are adding email addresses to multiple tables you're database design is wrong.
  6. One other thing not mentioned, you are storing your dates in the wrong format.
  7. You would need a joiner table like player_shirt so there can be multiple players on multiple teams. Pretty basic database design. So it would be like players_to_teams table with team_id and player_id. This would allow an unlimited amount of players to be on an unlimited amount of teams.
  8. Using extract like that is bad practice. All of a sudden your script has variables that just magically appear out of thin air. It will make debugging much harder to do when you don't know where stuff is coming from especially when the code base grows. Your active column should be 1 or 0, not Y and N and column type tinyint. You should also explicitly ask for your columns and not use *.
  9. OP is about thirty eight (38) versions of mysql behind. The issue in that version of Cent OS has been fixed. He will need to update his sources list and update from the package manager but there could still be an issue because the mysql config path was moved.
  10. Try setting max_allowed_packet to 1048576. This is a known problem in that version of Cent OS. If you can, upgrade to CentOS version 7. Did you do a manual Mysql install or from package? If you did manual, you are probably going to have additional problems after the max packet fix but lets see where you are at after the packet increase.
  11. You are using obsolete code that has been completely removed from PHP. Hiding errors with @ is a bad idea. You want to fix errors, not hide them, and why in the world are you echoing html? On top of that, page formatting goes in an external CSS file. This code looks like it was written in the 90's. All this x1, x2 x3 is ridiculous. You need to use PDO with prepared statements. https://phpdelusions.net/pdo
  12. Why did you stop binding the parameters when you got to $getid?
  13. For starters try running your code in IE8 and submit using the enter button. It will completely fail. Another example, If I was to submit your form using cURL, I have no idea that it depends on me also sending a button name to work so it will fail. The field names would be obvious.
  14. As Jaques1 has said, depending on the name of a button to be submitted is a bad idea. It wont always be and it will completely fail under certain circumstances. Always use if ($_SERVER['REQUEST_METHOD'] == 'POST') along with the hidden input if needed.
  15. YOU ARE VULNERABLE TO AN SQL INJECTION ATTACK! You NEVER EVER send user supplied data directly to the database. You are using obsolete Mysql code that has been completely removed from PHP. You need to use PDO. https://phpdelusions.net/pdo Page formatting needs to go in an external CSS file. The whole thing needs to be re-written and you need to update all your software versions. You are just begging to be hacked.
  16. The correction you need is to stop using obsolete code that has been completely removed from the current php version. Use PDO. Your current code is also ripe for an SQL Injection attack. You never ever send user supplied data directly to the database. https://phpdelusions.net/pdo
  17. You are using obsolete mysql code that has been completely removed from php. You need to use PDO with prepared statements. Here is a tutorial. https://phpdelusions.net/pdo
  18. No, this is not the best solution since it will completely fail under certain conditions. You are hoping the name of a button is going to be submitted and it wont always be. The correct method is if ($_SERVER['REQUEST_METHOD'] == 'POST')
  19. <?php foreach ($result as $row) { echo htmlentities($row['message']) .'<br>'; } ?>
  20. Give this a shot. Without a datadump I couldnt test it. SELECT u.username, u.email, u.`password`, m.message, g.group_id FROM users AS u INNER JOIN messages AS m ON m.username = u.username INNER JOIN message_group AS g ON g.username = m.username GROUP BY g.group_id ORDER BY m.`timestamp` ASC
  21. Funny you should say that. I have been learning Python the last couple weeks and there is only one way to do it which I am really liking. I have always thought that there were too many ways to do the same thing in PHP and it should just be one way. On several forums I started a post to see how many ways you could output the standard "Hello World!". There are over a hundred different ways. So it really depends on how you look at it as to whether it is great or not. As far as retaining the correct form values when there is an error, you still can without creating the extra variables like so. value="<?= !empty($_POST['field']) ? htmlspecialchars($_POST['field']) : '' ?>" When I said halt the script, I meant the same thing as you.
  22. You shouldn't have have a second query or third query. You need to do a single query with a join as I previously posted and you should be asking for specific columns, not using *.
×
×
  • 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.