The Entrepreneur Forum | Financial Freedom | Starting a Business | Motivation | Money | Success

Databases Problems Are Painful...

Learn how to build wealth and win financial freedom the Fastlane way!

Say "NO" to mediocre living rife with jobs, ascetic frugality, and suffocating savings rituals— learn how to build a Fastlane business that pays both freedom and lifestyle affluence. Join more than 70,000 entrepreneurs who are making it happen.
Join for FREE Today
Get the books
Remove ads? Join Fastlane INSIDERS
(Registration removes this block)

David Borodin

Contributor
Read Fastlane!
Oct 1, 2021
39
27
Bonjour,
So basically there is a problem that accrued recently... :xx:
I will try my best to explain it simply and save you time. :thumbsup:
If you have experience with it, and you have time to help me, I would absolutely appreciate it! :)
-------------------------------------------------------------------------------------------
I created a database in phpmyadmin,
I wrote PHP code in connect.php,
I wrote code in signin.html,
I connected them all together.
But still, this shows up:

Se kildebildet


------------------------------------------------------------------------------------------------
Here is my signin.html code:

<form method="post" action="connect.php">
<label>First Name...</label>
<input type="text" placeholder="" id="firstName" name="firstName">
<label>Last Name...</label>
<input type="text" placeholder="" id="lastName" name="lastName">
<label>Email</label>
<input type="email" placeholder="" id="email" name="email">
<label>Password...</label>
<input type="password" placeholder="" id="password" name="password">
<label>Comfirm Password...</label>
<input type="password" placeholder="">
<input type="submit" value="Submit" name="btn btn-primary">
</form>


----------------------------------------------------------------------------------------

Here is my connect.php code:

<?php
$firstName = filter_input(INPUT_POST, 'firstName');
$lastName = filter_input(INPUT_POST, 'lastName');
$email = filter_input(INPUT_POST, 'email');
$password = filter_input(INPUT_POST, 'password');
if (!empty($firstName)){
if (!empty($lastName)){
if (!empty($email)){
if (!empty($password)){
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "accounts";
// Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()){
die('Connect Error ('. mysqli_connect_error() .') '
. mysqli_connect_error());
}
else{
$sql = "INSERT INTO registration (firstName, lastName, email, password)
values ('$firstName', '$lastName', '$email', '$password')";
if ($conn->query($sql))}
echo "New record is inserted sucessfully";
}
else{
echo "Error: ".$sql . "<br>". $conn->error;
}
$conn->close();
}
}
else{
echo "Password should not be empty";
die();
}
}
else{
echo "Username should not be empty"
die();
}
?>

-------------------------------------------------------------------------------------------------------

I have watched countless of videos of this problem,
but nothing seems to explain the problem.
I know really little about PHP and databases in general.


Thank you for reading through,
I hope you can help.
If you need more information, please contact me.
 
Don't like ads? Remove them while supporting the forum: Subscribe to Fastlane Insiders.

schmidi

New Contributor
Apr 6, 2021
5
4
Deutschland
Bonjour,
So basically there is a problem that accrued recently... :xx:
I will try my best to explain it simply and save you time. :thumbsup:
If you have experience with it, and you have time to help me, I would absolutely appreciate it! :)
-------------------------------------------------------------------------------------------
I created a database in phpmyadmin,
I wrote PHP code in connect.php,
I wrote code in signin.html,
I connected them all together.
But still, this shows up:

Se kildebildet


------------------------------------------------------------------------------------------------
Here is my signin.html code:

<form method="post" action="connect.php">
<label>First Name...</label>
<input type="text" placeholder="" id="firstName" name="firstName">
<label>Last Name...</label>
<input type="text" placeholder="" id="lastName" name="lastName">
<label>Email</label>
<input type="email" placeholder="" id="email" name="email">
<label>Password...</label>
<input type="password" placeholder="" id="password" name="password">
<label>Comfirm Password...</label>
<input type="password" placeholder="">
<input type="submit" value="Submit" name="btn btn-primary">
</form>


----------------------------------------------------------------------------------------

Here is my connect.php code:

<?php
$firstName = filter_input(INPUT_POST, 'firstName');
$lastName = filter_input(INPUT_POST, 'lastName');
$email = filter_input(INPUT_POST, 'email');
$password = filter_input(INPUT_POST, 'password');
if (!empty($firstName)){
if (!empty($lastName)){
if (!empty($email)){
if (!empty($password)){
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "accounts";
// Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()){
die('Connect Error ('. mysqli_connect_error() .') '
. mysqli_connect_error());
}
else{
$sql = "INSERT INTO registration (firstName, lastName, email, password)
values ('$firstName', '$lastName', '$email', '$password')";
if ($conn->query($sql))}
echo "New record is inserted sucessfully";
}
else{
echo "Error: ".$sql . "<br>". $conn->error;
}
$conn->close();
}
}
else{
echo "Password should not be empty";
die();
}
}
else{
echo "Username should not be empty"
die();
}
?>

-------------------------------------------------------------------------------------------------------

I have watched countless of videos of this problem,
but nothing seems to explain the problem.
I know really little about PHP and databases in general.


Thank you for reading through,
I hope you can help.
If you need more information, please contact me.
Just two clues:
1. Stackoverflow is a really good resource for programming questions / problems / error messages.
2. A lot can go wrong by coding all yourself, SQL injections, missing indices, missing unique attributes .. I would go for some hosted solution instead of programming all myself. I am using firebase auth for my current project, they even have a ready ui: Easily add sign-in to your Web app with FirebaseUI
 

Mathuin

Provide Relative-Value or Die Trying
FASTLANE INSIDER
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Speedway Pass
Dec 20, 2020
302
806
Belfast, Northern Ireland
As @schmidi mentioned above, this is a question for Stack Overflow/ Reddit.
 

Post New Topic

Please SEARCH before posting.
Please select the BEST category.

Post new topic

New Topics

Fastlane Insiders

View the forum AD FREE.
Private, unindexed content
Detailed process/execution threads
Ideas needing execution, more!

Join Fastlane Insiders.

Must Read Books...

Explore books recommended by MJ DeMarco and other members of the Fastlane entrepreneurial community.
Fastlane Bookstore
Top