Connecting and inserting data into mysql table using php
<p>I am a PHP newbie and have been trying for sometime now to connect to MySQL database using PHP so I can insert data into a table I have created but I am unable to do this.</p>

<p>I suspect the problem is coming from my PHP <code>.ini</code> file,but that's just me.<br>
Would be grateful if anyone can help me configure my PHP <code>.ini</code> file so I can connect to MySQL and insert data into my table. Here is my PHP script in case you are wondering.<br>
Any help will be gratefully appreciated.</p>

<pre><code>&lt;?php

$host ="localhost";
$username = "username";
$password = "password";
$database = "database1";
$table ="users";
$con = mysql_connect("localhost","username","password");

if (!$con)
{
die('Could not connect:'.mysql_error());
}
mysql_select_db("database1",$con);


$mysql = "INSERT INTO $table(name,email,password)
VALUES('$_POST[name]','$_POST[email]','$_POST[password]";

if(mysql_query($mysql)) die(mysql_error()); 
echo"Data inserted";
mysql_close();
?&gt; 
</code></pre>
