Posted By

skrypets on 12/25/10


Tagged


Versions (?)

MySQL Connection


 / Published in: PHP
 

  1. $con = mysql_connect("localhost", "root", "root");
  2. if (!$con) {
  3. die('Could not connect: ' . mysql_error());
  4. }
  5.  
  6. mysql_select_db("sfcommunity", $con);
  7.  
  8. $sql = "INSERT INTO jos_users_info (FirstName, LastName, Company_name, Email)
  9. VALUES ('$_POST[name]','$_POST[lastname]','$_POST[companyname]','$_POST[email]')";
  10.  
  11. if (!mysql_query($sql, $con)) {
  12. die('Error: ' . mysql_error());
  13. }
  14. mysql_close($con);

Report this snippet  

You need to login to post a comment.