Welcome to Techno Smarter QA, Question, Answer forum. Ask questions, receive answers, or help someone. Join Now
Welcome to Techno Smarter Q&A, where you can ask questions and receive answers from other members of the community. Ask the Technical & Programming related questions that you want. Join our community and help others .
+2 votes

I have watched your video tutorial. I have done the same and cheacked each and every code line in PHP . Here is my PHP file code in which i have created a form to save(insert) data into MySQL database . 




<!DOCTYPE html>






<form action="" method="POST">



<tr><td><input type="text" name="name" ></td></tr>


<tr><td><input type = "email" name="email"></td></tr>


<tr><td><input type = "mobile" name="mobile"></td></tr>


<tr><td><input type = "date" name="date"></td></tr>

<tr><td><input type = "submit" name="submit"></td></tr>










    $result = mysqli_query($mysqli,"INSERT into record values('','$name','$email','$mobile','$date')");



    echo "Success";




    echo "Failed";






and config.php file..


$dbhost = 'localhost';

$dbname = 'engi';

$dbusername = 'root';

$dbpass = '';



I have used name engi  and table name record. 

If i submit data by pressing a button , it gives me nothin error or data doesn't save into the MySQL database . 

in PHP by (140 points) 1 1 4

1 Answer

0 votes

Data saving is another method of PHP programming in which you should have knowledge about connection file , MYSQL inserts query and HTML form then you will be able to save or insert database into the MYSQL database using PHP. I have checked your code and want to say about your query and connection. You are getting error from your connection code because dbpass     is not correct with empty value. I think you are getting error or your server is not displaying any error . You are missing a double quotation mark. 

$dbpass = '' ";

I can check that you are using single quotes . The standard of PHP says you use single quotation mark. 

$dbpass = ' ';

If you want to save HTML form data into MySQL database using PHP then you should use the INSERT query. I think you have an id auto-increment. 

The same pattern is missing here.  Lets discuss it . I thin you are missing a single quotation mark in your query. 

$result = mysqli_query($mysqli,"INSERT INTO record VALUES (' ','$name','$email','$mobile','$date')");

Now , check your code and make it correct and execute . 

I have other tutorials for you  . 

Insert data and display in HTML table using PHP 

Insert(Signup) form in PHP 


by (7.2k points) 14 29 62