âšī¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 2.9 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/ |
| Last Crawled | 2026-01-15 22:54:21 (2 months ago) |
| First Indexed | 2020-05-12 15:56:01 (5 years ago) |
| HTTP Status Code | 200 |
| Meta Title | How to save data in MYSQL database - MySQL Help - PHP Freaks |
| Meta Description | Hi! So due to this pandemic I've decided to do some programming just for fun in preparation for school in september. I am currently focused on just creating a simple login and registration page. The registration page is supposed to add the users entered data into the MYSQL database and then redir... |
| Meta Canonical | null |
| Boilerpipe Text | Hi slotegraafd,
I'm just a normal user here so you should wait for pros to help you. However, i would still like to offer my opinion about your posted code: pdo is a safer solution to interacting with a database. I recommend that you switch to pdo: https://phpdelusions.net/pdo
I've never understood error arrays and pushing data into them. a simple binary switch can be used to deal with error scenarios and a variable or array for error messages only:
$error = 0; if (empty(bla_bla)) { $errors = 1; $message = 'bla_bla contains no usable data'; }
if($errors) { //code to handle errors }
//else continue or no else if header relocation exit is used if $errors
if one of the required fields is empty or erroneous then just cut out completely and stop evaluating the rest of the data.
you should use password_verify to check the password. MAJOR security error here. Also, hashing passwords as a student testing login scripts is not necessary but it is absolutely necessary on live site. encryption is not a protection mechnism. Use hashes. skip for now but never forget to hash the passwords (which also requires a rehash if php changed something as the default encryption method.)
you use a header relocate without an exit:
header('location: home.php');
change this to:
header('location: home.php'); exit;
to stop evaluation of the rest of the script.
i wouldn't escape input. I recommend that you validate input then compare login values. In any event, just use htmlentities with ENT_QUOTES or html special chars before outputting post data or using it in anyway.
you have the following code:
f (mysqli_num_rows($results) == 1)
you need to verify that the usernames match and that the passwords match:
if ($username === $resultfromdb && password_verify()) { } else {}
password verify works like so:
if (hash_equals($usernameFromDB, $username) && password_verify($password, $passwordFromDB)) { } else { }
Start with pdo then try again. I'm sure that pro members will help you further.
Good luck and i hope that you switch to pdo for security purposes. Learn proper coding early to save many headaches and problems. |
| Markdown | [Jump to content](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#ipsLayout_mainArea "Go to main content on this page")
[](https://forums.phpfreaks.com/)
- [Existing user? Sign In](https://forums.phpfreaks.com/login/)
- [Sign Up](https://forums.phpfreaks.com/register/)
- [Browse](https://forums.phpfreaks.com/)
- [Forums](https://forums.phpfreaks.com/)
- [Staff](https://forums.phpfreaks.com/staff/)
- [Leaderboard](https://forums.phpfreaks.com/leaderboard/)
- [Guidelines](https://forums.phpfreaks.com/guidelines/)
- [Terms of Service](https://forums.phpfreaks.com/terms/)
- [More](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [Activity](https://forums.phpfreaks.com/discover/)
- [All Activity](https://forums.phpfreaks.com/discover/)
- [Search](https://forums.phpfreaks.com/search/)
- [More](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [Join our Discord\!](https://discord.gg/7Svm6kJB4d)
- [More](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [More](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [MySQL Help](https://forums.phpfreaks.com/forum/15-mysql-help/)
- [All Activity](https://forums.phpfreaks.com/discover/)
- [Home](https://forums.phpfreaks.com/ "Home")
- [SQL / Database](https://forums.phpfreaks.com/forum/5-sql-database/)
- [MySQL Help](https://forums.phpfreaks.com/forum/15-mysql-help/)
- How to save data in MYSQL database
# How to save data in MYSQL database
***
[](https://forums.phpfreaks.com/profile/209884-slotegraafd/ "Go to slotegraafd's profile")
**By [slotegraafd](https://forums.phpfreaks.com/profile/209884-slotegraafd/ "Go to slotegraafd's profile")** May 12, 2020 in [MySQL Help](https://forums.phpfreaks.com/forum/15-mysql-help/)
[Share](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#elShareItem_954426944_menu)
<https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/>
***
More sharing options...
[Followers 2](https://forums.phpfreaks.com/login/ "Sign in to follow this")
- [Reply to this topic](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#replyForm)
- [Start new topic](https://forums.phpfreaks.com/forum/15-mysql-help/?do=add "Start a new topic in this forum")
- [Prev](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#comments "Previous page")
- [1](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#comments)
- [2](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/page/2/#comments)
- [Next](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/page/2/#comments "Next page")
- [Page 1 of 2](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
## Recommended Posts
- [Prev](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#comments "Previous page")
- [1](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#comments)
- [2](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/page/2/#comments)
- [Next](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/page/2/#comments "Next page")
- [Page 1 of 2](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
This thread is more than a year old. Please don't revive it unless you have something important to add.
## Join the conversation
You can post now and register later. If you have an account, [sign in now](https://forums.phpfreaks.com/login/) to post with your account.
[Share](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#elShareItem_1285559971_menu)
<https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/>
***
More sharing options...
[Followers 2](https://forums.phpfreaks.com/login/ "Sign in to follow this")
[Go to topic listing](https://forums.phpfreaks.com/forum/15-mysql-help/ "Go to MySQL Help")
- [All Activity](https://forums.phpfreaks.com/discover/)
- [Home](https://forums.phpfreaks.com/ "Home")
- [SQL / Database](https://forums.phpfreaks.com/forum/5-sql-database/)
- [MySQL Help](https://forums.phpfreaks.com/forum/15-mysql-help/)
- How to save data in MYSQL database
- [Theme](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/#elNavTheme_menu)
- [Contact Us](https://forums.phpfreaks.com/contact/)
- [Cookies](https://forums.phpfreaks.com/cookies/)
PHP Freaks [Powered by Invision Community](https://www.invisioncommunity.com/ "Invision Community")
[Ã](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [Existing user? Sign In](https://forums.phpfreaks.com/login/)
- [Sign Up](https://forums.phpfreaks.com/register/)
- #### [Browse](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [Back](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [Forums](https://forums.phpfreaks.com/)
- [Staff](https://forums.phpfreaks.com/staff/)
- [Leaderboard](https://forums.phpfreaks.com/leaderboard/)
- [Guidelines](https://forums.phpfreaks.com/guidelines/)
- [Terms of Service](https://forums.phpfreaks.com/terms/)
- #### [Activity](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [Back](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- [All Activity](https://forums.phpfreaks.com/discover/)
- [Search](https://forums.phpfreaks.com/search/)
- [Join our Discord\!](https://discord.gg/7Svm6kJB4d)
[Ã](https://forums.phpfreaks.com/topic/310755-how-to-save-data-in-mysql-database/)
- Create New...
## Important Information
We have placed [cookies](https://forums.phpfreaks.com/cookies/) on your device to help make this website better. You can [adjust your cookie settings](https://forums.phpfreaks.com/cookies/), otherwise we'll assume you're okay to continue. |
| Readable Markdown | null |
| Shard | 83 (laksa) |
| Root Hash | 6912566579114601883 |
| Unparsed URL | com,phpfreaks!forums,/topic/310755-how-to-save-data-in-mysql-database/ s443 |