WAMP is an acronym formed from the initials of the operating system
Microsoft Windows and the principal components of the package: Apache, MySQL and one of PHP, Perl or Python. Apache is a web server.
MySQL is an open-source database. PHP, Perl and Python are scripting
languages that can manipulate information held in a database and
generate web pages dynamically each time content is requested by a
browser. Other programs may also be included in a package, such as phpMyAdmin which provides a graphical user interface for the MySQL database manager.
Setpwise Procedure to Create webpage ,Connect to database and Inserting data.
1-Install Wamp Server On PC. You can Get Installation tutorial on any website.
2- Now Start the Wamp Server and do right click and click on phpmyadmin .
PhphMyadmin page will open and clikc on New database and create new database with uyour name
Now Create new table name as info with two field name as first and last
remaing field let it be empty.
We are done with database .Now Create Web page
3- Make Simple webpage with two textbox... First Name and Last Name
code of html page-
<html>
<head>
</head>
<body>
<h1>My First Php Web Page</h1>
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
<input type="Submit">
</form>
</body>
</html>
Save this file as index.html
Step 2- Make Php File Which Handle that request-
<?php
$database="jayesh"; //database name
$first=$_POST['first'];//this values comes from html file after submitting
$last=$_POST['last'];
$con = mysql_connect("localhost","root" ,"");//for wamp 3rd feild is balnk
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
$query = "INSERT INTO info (first,last)VALUES ('$first','$last')";
mysql_query($query);
echo "<script type='text/javascript'>\n";
echo "alert('you are Succesflly registered');\n";
echo "</script>";
mysql_close();
?>
save this file as insert.php.
3-Put this both file in single Folder and Put this folder in Wamp installation directory, inside WWW folder
defalut path is =C:\wamp\www\
4- Now again do right click and click on local host . Main Page of wampserver will open.
On bottom left of project you will find directory in which we store both file. Click on that folder
Our index.html page will open
It will Look Like this--->
Now Enter the details and and Submit it. Message box will come that you successfully insert data in database , in that way you can try for delete and modify operation.
Keep Sharing and Comment if any Difficulty...
Setpwise Procedure to Create webpage ,Connect to database and Inserting data.
1-Install Wamp Server On PC. You can Get Installation tutorial on any website.
2- Now Start the Wamp Server and do right click and click on phpmyadmin .
PhphMyadmin page will open and clikc on New database and create new database with uyour name
Now Create new table name as info with two field name as first and last
remaing field let it be empty.
We are done with database .Now Create Web page
3- Make Simple webpage with two textbox... First Name and Last Name
code of html page-
<html>
<head>
</head>
<body>
<h1>My First Php Web Page</h1>
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
<input type="Submit">
</form>
</body>
</html>
Save this file as index.html
Step 2- Make Php File Which Handle that request-
<?php
$database="jayesh"; //database name
$first=$_POST['first'];//this values comes from html file after submitting
$last=$_POST['last'];
$con = mysql_connect("localhost","root" ,"");//for wamp 3rd feild is balnk
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
$query = "INSERT INTO info (first,last)VALUES ('$first','$last')";
mysql_query($query);
echo "<script type='text/javascript'>\n";
echo "alert('you are Succesflly registered');\n";
echo "</script>";
mysql_close();
?>
save this file as insert.php.
3-Put this both file in single Folder and Put this folder in Wamp installation directory, inside WWW folder
defalut path is =C:\wamp\www\
4- Now again do right click and click on local host . Main Page of wampserver will open.
On bottom left of project you will find directory in which we store both file. Click on that folder
Our index.html page will open
It will Look Like this--->
Now Enter the details and and Submit it. Message box will come that you successfully insert data in database , in that way you can try for delete and modify operation.
Keep Sharing and Comment if any Difficulty...
After inserting data into the form, it tells me successfully inserted but problem is now that how do i view the data I have inserted through the form in the databse..i am not seeing it. and how do i add more data into the database for example if i have a registration form, then also a complaint for and more..
ReplyDeletei get same successfully entered data but it doesnt shows up
Deletethanks for the tutorial. it really helped. however after doing all this i choose to increase my tables to about 7 with a textarea object but it doesn't save anymore... thanks for the anticipated help
ReplyDeleteThank you very much ............this code really made my day!!!!
ReplyDeletehey i want to go to another page on succesfully login>>>>
ReplyDeletego to example.php
thnx...for d tutotial.... it really helps me a lot....
ReplyDeletethank you so much..
ReplyDeletei like it
ReplyDeletethe message comes like this "\n"; echo "alert('you are Succesflly registered');\n"; echo ""; - "
ReplyDeleteand i couldnt see the result
same problem..
DeleteI have been searching the internet for the past nine hours. I was close to a pitiful death until I came here. You have helped me beyond what any person has helped me before. You have rescued me from the pit of desperation and frustration, and brought me back into the light of understanding. A toast to your good sir. May you have long days and pleasant nights for as long as you shall live. Thank you.
ReplyDeleteThanks! That really helped me alot
ReplyDeletephoto tagging code with demo with database
ReplyDeletehttp://www.lessonwithdemo.com/205/ajax/photo-tagging-like-facebook-without-page-refresh-with-ajax-without-jquery.php/
http://axegahukar.blogspot.in/2014/08/how-to-connect-database-in-aspnet.html
ReplyDeletecan't access the code . when i click submit button appear for full code
ReplyDeletei created a folder of the 2 files specifies inside folder www. but the files din't run.Plzz tell what is the problem
ReplyDeleteSalaaaam....! How can i see the data in database... help me....
ReplyDeleteI am getting this error. Please help
ReplyDelete( ! ) Notice: Undefined index: first in C:\wamp\www\insert.php on line 10
Call Stack
# Time Memory Function Location
1 0.0520 134144 {main}( ) ..\insert.php:0
( ! ) Notice: Undefined index: last in C:\wamp\www\insert.php on line 11
Call Stack
# Time Memory Function Location
1 0.0520 134144 {main}( ) ..\insert.php:0
( ! ) Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\wamp\www\insert.php on line 17
Call Stack
# Time Memory Function Location
1 0.0520 134144 {main}( ) ..\insert.php:0
2 0.2130 141784 mysqli_select_db ( ) ..\insert.php:17
( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\insert.php on line 19
Call Stack
# Time Memory Function Location
1 0.0520 134144 {main}( ) ..\insert.php:0
2 0.3540 141928 mysqli_query ( ) ..\insert.php:19
It is showing error message when i click on submit, it shows "Not Found
ReplyDeleteThe requested URL /insert.php was not found on this server."
What to do???
I like your post about database ... How create Database connection in php using wamp server http://bit.ly/1NOelur
ReplyDeleteThank you very much for your good tutorial.well understood.
ReplyDeleteThank You Very Much I was trying for same of about 1 month but i finally found this here.Once again thank you
ReplyDeleteAfter submission of the form, it did not show in the database.. the reason been that there is little code missing here
ReplyDelete$query = "INSERT INTO info (first,last)VALUES ('$first','$last')";
mysql_query($query);
it suppose to be
$query = "INSERT INTO info (first,last)VALUES ('$_POST[first]','$_POST[last]')";
mysql_query($query);
1 error
ReplyDeleteDeprecated:MySQL_connect (); the MySQL extension is deprecated and will be removed in the future: use MySQL or pdi instead in path on line 10
Plz anyone can fix this
1 error
ReplyDeleteDeprecated:MySQL_connect (); the MySQL extension is deprecated and will be removed in the future: use MySQL or pdi instead in path on line 10
Plz anyone can fix this
( ! ) Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp2\www\insert.php on line 6
ReplyDeletehow to solve this type of error
thank you....
ReplyDeletethank you....
ReplyDeleteHOW DO I SEE THE DATA I HAVE INSERTED?
ReplyDeleteCool
ReplyDeletei like your blogpost thanks for share how to connect database in Php with wamp server
ReplyDeleteOhhh thank God, I ve been struggling with this for 3hrs, well Thx,
ReplyDeleteI ve another issue, I created users and each user has apassword, to my surprised, any user can use any password so long as da password is in da database, eg a user landus with password 111, en user temba with password 333, but user temba can login using password for landus, ???? How can I overcome this, thanks
It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us. Website Development Bangalore | Web Design Company Bangalore India
ReplyDeleteThe blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up..Website Developers Bangalore | Website Designing Bangalore
ReplyDeleteThanx for the blog
ReplyDeleteThanx for the blog
ReplyDeleteThanks for sharing this type of information. It's very helpful for everyone. Keep posting. php course in pune
ReplyDeleteIt does display that you have successfully registered.
ReplyDeleteHowever, it does not display the result. It gives the following error.
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp64\www\insert.php on line 5
Please help me out
Thnku vry much...successfully tested the code...vry hppy tday :)
ReplyDeleteThis code really made my day
Thnku vry much...successfully tested the code...vry hppy tday :)
ReplyDeleteThis code really made my day
This comment has been removed by the author.
ReplyDeleteexcellent description thanks alot!!!
ReplyDeleteThank you for posting and sharing such great information.
ReplyDeleteWebsite Designing Company in Bangalore | Web Development Company Bangalore
Very Useful Post!Thanks!
ReplyDeletePHP Programming Help
This comment has been removed by the author.
ReplyDeletesir i follow the same step as u text in above lines but i hav this error:
ReplyDelete( ! ) Fatal error: Uncaught Error: Call to undefined function mysql_connect() in F:\wamp\www\New folder\insert.php on line 5
( ! ) Error: Call to undefined function mysql_connect() in F:\wamp\www\New folder\insert.php on line 5
plz help me to solve this..
waooo nice post regarding "PHP to MySql Database connection in WAMP Server"
ReplyDeleteThanks,
Crude Oil Trading Tips | Mcx Tips Free Trial
Webtrackker technology is the best IT training institute in NCR. Webtrackker provide training on all latest technology such as Php training. Webtrackker is not only training institute but also it also provide best IT solution to his client. Webtrackker provide training by experienced and working in the industry on same technology.Webtrackker Technology C-67 Sector-63 Noida 8802820025
ReplyDeletePhp training institute in indirapuram
Php training institute in Noida
Php training institute in Ghaziabad
Php training institute in Vaishali
Php training institute in Vasundhara
Php training institute in Delhi South Ex
THANX
ReplyDeleteThis comment has been removed by the author.
ReplyDeletethank u...
ReplyDeletebefore taking database connection,
type " use database_name;" in MySQL console..
Will try, hope its all we need...For best and cheap manual Seo services, Web designings. Must check Web Design Bangalore
ReplyDeleteYour blog is very helpful and informative indeed. Thank you for sharing. For more information visit our websitePHP training
ReplyDeleteI went through your website it was really informative do visit my blog
ReplyDelete• Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online course hyderabad
ReplyDeleteThat's wonderful stuff you've written up here. Been searching for it all around. Great blog
ReplyDeleteWeb developers in bangalore
Website Design and Development Companies in Bangalore
Nice blog Content.It is very informative and helpful. Please share more content. Thanks.
ReplyDeletePHP Training in Gurgaon
PHP Course in Gurgaon
PHP Institute in Gurgaon
Really very informative and creative contents. This concept is a good way to enhance the knowledge.thanks for sharing. please
ReplyDeletekeep it up.
PHP Training in Gurgaon
Really your content is so informative. So please share some more content ..
ReplyDeletePHP course in Noida
WordPress Training
ReplyDeleteWeb Designing Course in Delhi
SEO Course
PHP Training in Delhi
SMO Training
PPC Institute in Delhi
WordPress Training
ReplyDeleteWeb Designing Course in Delhi
SEO Course
PHP Training in Delhi
SMO Training
PPC Institute in Delhi
You really touched few great points of interest which might plainly be considerable for many visitors. I admire you for making such a pleasant article accessible to us. Keep blogging.
ReplyDeleteWebsite Design Agency | Website design company
Nice blog Content.It is very informative and helpful. Please share more content. Thanks.
ReplyDeletePHP Training in Gurgaon
Nice blog.Gained more information about php.Keep blogging.for further reference refer php training in coimbatore
ReplyDeleteKudos! Nice article. Informative and simple. If video, was there, still more informative and understandable. I work for non-profit organization and information stated would assist me organization very well.
ReplyDeleteMobile App Development Company
Really greati information your sharing , its good to every readers.
ReplyDeletetop software development companies
custom software development company
web and mobile app development company
much needed information for my project and it works successfully. Thank you!!!!!
ReplyDeleteI would like to say thank you for the amazing details and concepts you are sharing in this.The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers! to read. I never stop myself to say something about it. You’re doing a great job. Keep it up...
Microsoft Windows Azure Training | Online Course | Certification in chennai | Microsoft Windows Azure Training | Online Course | Certification in bangalore | Microsoft Windows Azure Training | Online Course | Certification in hyderabad | Microsoft Windows Azure Training | Online Course | Certification in pune
Nice Post, Keep posting in the future as well, Now i am going to tell you about Training icon which is a leading It training institute in Delhi NCR so if you are looking for any type of training ,you can visit.
ReplyDeleteTrainingicon.in for Learn HTML,CSS and Jquery
Trainingicon.in for PHP training
Trainingicon.in for Data Analytics Course
Trainingicon.in for R Programming Course
Trainingicon.in for MIS Programming Course
Trainingicon.in for WordPress Programming Course
Trainingicon.in for SAS Programming Course
The Original Forex Trading System: roboforex login Is The Original Forex Trading System. It Is 100% Automated And Provides An Easy-to-follow Trading System. You Get Access To Real-time Signals, Proven Methods, And A Money-back Guarantee.
ReplyDeleteIt's a superb article you've written here. Your article provided me with some unique and useful knowledge. Many thanks for bringing this post to our attention. PHP Training in delhi
ReplyDeleteNice post, As you all guys know php programming and PHP also have a collection of errors so i am specifing some errors below.
ReplyDeletecomposer detected issues in your platform
Thanks for the informative article. This is one of the best tips in my life. I have in quite some time. Nicely written and great info. I really cannot thank you enough for sharing. Taκе a look at mу ωeb site Free Credit Card Number
ReplyDelete