TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
701
1.3k
217.3k
Doent insert into DB. Why?
Dec 13 2019 10:17 AM
Hi,
As a new PHP programer I am testing to insert datas into my database. Every things are showing me that the codes are well. For example I test the connection to my database it's fine:
I am using PHP 7.3.10 on Windows 10
testconnection.php
$conn = new mysqli("localhost", "root", "", "login");
if ($conn->connect_error) {
die("ERROR: Unable to connect: " . $conn->connect_error);
}
echo 'Connected to the database.
';
$result = $conn->query("SELECT * FROM usuario");
echo "Number of rows: $result->num_rows";
$result->close();
$conn->close();
?>
//I receive this message:
Connected to the database.
Number of rows: 2
Inserttodb.php
$link=mysqli_connect("localhost","root","");
mysqli_select_db($link,"phpmysqli");
?>
if(isset($_POST["submit"]))
{
mysqli_query($link,"insert into table1 values('$_POST[t1]','$_POST[t2]')");
}
?>
When I insert data ist doesnt show any error. But when I check in phpMysql there is nothing. Ouuuf, I passed days to resolv this. But nothing!!!
Reply
Answers (
6
)
use of header() function in PHP
inserting multiple values to database