PHP CONNECTION - BEST PRACTISE TIPS [on hold]
$begingroup$
I have been learning phpmyadmin, this is my current learning/test
environment below.
I created my first database today I refer to as db1 it is simple structure
with only three input fields.
And one primary id in phpmyadmin.
And one unique structure field for username.
Any further recommendations aparty from adding POD would be appreciative.
index.html:
<html>
<head>
<title>db1 test</title>
</head>
<body>
<form id="myForm" action="userInfo.php" method="post">
Username: <input type="text" name="username" /><br />
Name: <input type="text" name="name" /><br />
Favourite Number: <input type="text" name="favouritenumber" `
/><br />`
<button id="sub">Save</button>
</form>
<span id="result"></span>
<script src="/script/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="/script/my_script.js" type="text/javascript"></script>
</body>
</html>
db.php:
<?php
$host = "localhost";
$port = "8889";
$servername = "$host";
$username = "forest";
$password = "";
$db = "db1";
// Create connection
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
info.php:
<?php
include_once "/includes/db1.php";
$username = $_POST['username'];
$name = $_POST['name'];
$favouritenumber = $_POST['favouritenumber'];
if(mysqli_query($conn,"INSERT INTO user(username,name,favouritenumber) VALUES ('$username', '$name', '$favouritenumber');"))
echo "Successfully Inserted";
//echo "<a href='login_success.php'>Back to main page</a>";
else {
echo "ERROR not entered";
}
// close connection
mysqli_close();
?>
php mysqli
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
put on hold as off-topic by Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ 7 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I have been learning phpmyadmin, this is my current learning/test
environment below.
I created my first database today I refer to as db1 it is simple structure
with only three input fields.
And one primary id in phpmyadmin.
And one unique structure field for username.
Any further recommendations aparty from adding POD would be appreciative.
index.html:
<html>
<head>
<title>db1 test</title>
</head>
<body>
<form id="myForm" action="userInfo.php" method="post">
Username: <input type="text" name="username" /><br />
Name: <input type="text" name="name" /><br />
Favourite Number: <input type="text" name="favouritenumber" `
/><br />`
<button id="sub">Save</button>
</form>
<span id="result"></span>
<script src="/script/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="/script/my_script.js" type="text/javascript"></script>
</body>
</html>
db.php:
<?php
$host = "localhost";
$port = "8889";
$servername = "$host";
$username = "forest";
$password = "";
$db = "db1";
// Create connection
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
info.php:
<?php
include_once "/includes/db1.php";
$username = $_POST['username'];
$name = $_POST['name'];
$favouritenumber = $_POST['favouritenumber'];
if(mysqli_query($conn,"INSERT INTO user(username,name,favouritenumber) VALUES ('$username', '$name', '$favouritenumber');"))
echo "Successfully Inserted";
//echo "<a href='login_success.php'>Back to main page</a>";
else {
echo "ERROR not entered";
}
// close connection
mysqli_close();
?>
php mysqli
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
put on hold as off-topic by Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ 7 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed."
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
7 hours ago
$begingroup$
hello this code is working thankyou anyway
$endgroup$
– zip
5 mins ago
add a comment |
$begingroup$
I have been learning phpmyadmin, this is my current learning/test
environment below.
I created my first database today I refer to as db1 it is simple structure
with only three input fields.
And one primary id in phpmyadmin.
And one unique structure field for username.
Any further recommendations aparty from adding POD would be appreciative.
index.html:
<html>
<head>
<title>db1 test</title>
</head>
<body>
<form id="myForm" action="userInfo.php" method="post">
Username: <input type="text" name="username" /><br />
Name: <input type="text" name="name" /><br />
Favourite Number: <input type="text" name="favouritenumber" `
/><br />`
<button id="sub">Save</button>
</form>
<span id="result"></span>
<script src="/script/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="/script/my_script.js" type="text/javascript"></script>
</body>
</html>
db.php:
<?php
$host = "localhost";
$port = "8889";
$servername = "$host";
$username = "forest";
$password = "";
$db = "db1";
// Create connection
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
info.php:
<?php
include_once "/includes/db1.php";
$username = $_POST['username'];
$name = $_POST['name'];
$favouritenumber = $_POST['favouritenumber'];
if(mysqli_query($conn,"INSERT INTO user(username,name,favouritenumber) VALUES ('$username', '$name', '$favouritenumber');"))
echo "Successfully Inserted";
//echo "<a href='login_success.php'>Back to main page</a>";
else {
echo "ERROR not entered";
}
// close connection
mysqli_close();
?>
php mysqli
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I have been learning phpmyadmin, this is my current learning/test
environment below.
I created my first database today I refer to as db1 it is simple structure
with only three input fields.
And one primary id in phpmyadmin.
And one unique structure field for username.
Any further recommendations aparty from adding POD would be appreciative.
index.html:
<html>
<head>
<title>db1 test</title>
</head>
<body>
<form id="myForm" action="userInfo.php" method="post">
Username: <input type="text" name="username" /><br />
Name: <input type="text" name="name" /><br />
Favourite Number: <input type="text" name="favouritenumber" `
/><br />`
<button id="sub">Save</button>
</form>
<span id="result"></span>
<script src="/script/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="/script/my_script.js" type="text/javascript"></script>
</body>
</html>
db.php:
<?php
$host = "localhost";
$port = "8889";
$servername = "$host";
$username = "forest";
$password = "";
$db = "db1";
// Create connection
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
info.php:
<?php
include_once "/includes/db1.php";
$username = $_POST['username'];
$name = $_POST['name'];
$favouritenumber = $_POST['favouritenumber'];
if(mysqli_query($conn,"INSERT INTO user(username,name,favouritenumber) VALUES ('$username', '$name', '$favouritenumber');"))
echo "Successfully Inserted";
//echo "<a href='login_success.php'>Back to main page</a>";
else {
echo "ERROR not entered";
}
// close connection
mysqli_close();
?>
php mysqli
php mysqli
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 1 min ago
zip
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 12 hours ago
zipzip
12
12
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
zip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ 7 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ 7 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed."
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
7 hours ago
$begingroup$
hello this code is working thankyou anyway
$endgroup$
– zip
5 mins ago
add a comment |
$begingroup$
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed."
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
7 hours ago
$begingroup$
hello this code is working thankyou anyway
$endgroup$
– zip
5 mins ago
$begingroup$
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed."
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
7 hours ago
$begingroup$
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed."
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
7 hours ago
$begingroup$
hello this code is working thankyou anyway
$endgroup$
– zip
5 mins ago
$begingroup$
hello this code is working thankyou anyway
$endgroup$
– zip
5 mins ago
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note that it states "If you are looking for feedback on a specific working piece of code...then you are in the right place!" Also, when posting your question, there should have been text on the side that read "Your question must contain code that is already working correctly..." When you have fixed the code, please edit your post to include the working code and it can be reviewed."
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
7 hours ago
$begingroup$
hello this code is working thankyou anyway
$endgroup$
– zip
5 mins ago