I have mysql installed in my system.I want to use it in php script. to store some html form inputs.
- Managing Spam via IMAP
- Computer Virus On My Computer- Never!
- How To Determine The Origin Of Spam?
- 2008: Major Concerns for Network and Systems Administrators
- Spam Filtering
- How Anti Spam Software Works
- How Bayesian Spam Filters Work
- Google’s Tag To Remove Content Spamming
- What is the Point of Do-follow Links on Blogs?
- MBR_CHECKSUM_MISMATCH Hard Drive Error and Recovery


First, create a table to store the data in mysql. If you don’t have much experience with command line mysql, you can use a web interface called phpMyAdmin.
Once you have created your table, these are the steps to do a basic insert:
1. Create db connection and select db:
$link=mysql_connect (“$server”, “$user”, “$pwd”) or die (‘Connection failed: ‘ . mysql_error());
mysql_select_db(“yourDB”);
2. Create query:
$query=”INSERT INTO yourTable(‘name’,'phone’,'age’) VALUES (‘John’,’123-456′,23);
3. Execute query:
mysql_query($query);
That is just a very simple example, you should look at the PHP manual (www.php.net) for more information.
To insert from data into the database use the INSERT statement from answer two and reference the from elements.
$query=”INSERT INTO yourTable(‘name’,'phone’,'age’) VALUES (‘.$_POST["name"].’,’.$_POST["number"].’…
It’s also a good idea to protect the data from SQL injections using the mySQL function mysql_real_escape_string().
Just to expound on what others have said, never, under any circumstances, insert a form value directly into a MySQL query. It’s kind of like begging to be hacked.
If the value is supposed to be a number, check to be sure its numeric
if(is_numeric($_POST['value'])) {
$value = $_POST['value'];
// do something
} else {
echo(“FAILED!”);
}
If it isn’t numeric, such as a text or varying character field, use mysql_real_escape_string.
$value = mysql_real_escape_string($_POST['value']…
Use the “mysqli” library.