Posted By

vdubplate on 07/14/12


Tagged


Versions (?)

Add info to mysql table


 / Published in: MySQL
 

$connect = mysql_connect("localhost:8889","root","root");

Means: server, user, pass

  1. <?php
  2.  
  3. $connect = mysql_connect("localhost:8889","root","root");
  4. if (!$connect)
  5. {
  6. die('Could not connect: ' . mysql_error());
  7. }
  8.  
  9. mysql_select_db("ourDatavase", $connect);
  10.  
  11. mysql_query("INSERT INTO someData (name, email, address)
  12. VALUES ('Peter', '[email protected]', '35 curtis way')") || die(mysql_error());
  13.  
  14. mysql_query("INSERT INTO someData (name, email, address)
  15. VALUES ('POooFace', '[email protected]', '33 poo way')") || die(mysql_error());
  16.  
  17. mysql_close($connect);
  18.  
  19.  
  20.  
  21. ?>

Report this snippet  

You need to login to post a comment.