MySQL connection with PHP


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



Copy this code and paste it in your HTML
  1. <?php
  2. mysql_connect("localhost","root","asdf") or die (mysql_error());
  3.  
  4. $result = mysql_query('SELECT * FROM tabellename') or die (mysql_error());
  5.  
  6. while($entry = mysql_fetch_assoc($result)){
  7. $entry['headline']
  8. }
  9.  
  10.  
  11.  
  12.  
  13. $entry= "INSERT INTO tabellename (feld1, feld2) VALUES ('111111s', '2222222s');";
  14. $init = mysql_query($entry);
  15.  
  16. $change = "UPDATE blog Set tag = 'Cinema 4D' WHERE id = '2'";
  17. $update = mysql_query($change);
  18. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.