-
Posts
2,134 -
Joined
-
Last visited
-
Days Won
42
Everything posted by benanamen
-
I dont see a thing about a subscribed value or a sub field or any function. I have no idea what your doing.
-
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?
-
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
-
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.
-
If you are adding email addresses to multiple tables you're database design is wrong.
-
One other thing not mentioned, you are storing your dates in the wrong format.
-
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.
-
mysqli_fetch_array() expects parameter 1 to be mysqli_result
benanamen replied to WeBBy421's topic in PHP Coding Help
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 *. -
I get the mysql server has gone away every command i enter
benanamen replied to ballhogjoni's topic in MySQL Help
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. -
I get the mysql server has gone away every command i enter
benanamen replied to ballhogjoni's topic in MySQL Help
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. -
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
-
Why did you stop binding the parameters when you got to $getid?
-
How to handle different form submit actions on the same page?
benanamen replied to greenace92's topic in PHP Coding Help
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. -
How to handle different form submit actions on the same page?
benanamen replied to greenace92's topic in PHP Coding Help
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. -
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.
-
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
-
adding items to a shopping cart through html form
benanamen replied to pwesthead's topic in PHP Coding Help
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 -
The contact form on my website keeps sending me blank emails!
benanamen replied to dragon42tt's topic in PHP Coding Help
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') -
echo $foo = '"bar"';
-
How to order message_groups/messages just like imessage?
benanamen replied to Lukeidiot's topic in MySQL Help
<?php foreach ($result as $row) { echo htmlentities($row['message']) .'<br>'; } ?> -
How to order message_groups/messages just like imessage?
benanamen replied to Lukeidiot's topic in MySQL Help
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 -
Your missing url
-
You bound ID but then didn't use it.
-
Sticky form help; PHP code is showing in HTML form
benanamen replied to ctapp's topic in PHP Coding Help
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. -
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 *.