How do I get a web form to write to a MySQL database using PHP myAdmin?
-
I am trying to use a webform to post data to my MySQL database. I have all of this set up on my website that is hosted on yahoo. I have php MyAdmin installed on the server to manage the database. For some reason, I can't get my webform to post the info to my database. Can anyone help?
-
Answer:
<?php // assuming you are posting a field called 'first_name' $first_name =$_POST['first_name']; //use proper values for mysql_user and mysql_password //use proper value for localhost, if you are not using local host. $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } //assuming you are entering this field in a table called 'myfriends' $query = "INSERT INTO myfriends(first_name) VALUES('$first_name')"; mysql_query($query); mysql_close($link); ?>
eric j at Yahoo! Answers Visit the source
Other answers
Related Q & A:
- How can I get a web design job in Toronto?Best solution by Yahoo! Answers
- How do you get a Web Content Administrator job in Northern Ireland?Best solution by Yahoo! Answers
- How can I get my web cam to work on MSN?Best solution by Yahoo! Answers
- How can I get a job at a resort for a Summer?Best solution by eHow old
- How do i get my web site listed in search results?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.