Add info to mysql table


/ Published in: MySQL
Save to your folder(s)

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

Means: server, user, pass


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.