Interaccion MySQL-php


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

Codigo basico para la interaccion con una bd en MySQL desde php


Copy this code and paste it in your HTML
  1. <?php
  2. mysql_connect("localhost", "login1", "password1") or
  3. die("Could not connect: " . mysql_error());
  4. mysql_select_db("test");
  5.  
  6. $resultado=mysql_query("select * from test1");
  7. while($rec = mysql_fetch_array($resultado)){
  8. echo $rec[0]." ";
  9. echo $rec[1]." ";
  10. echo $rec[2]." ";
  11. }
  12. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.