Ver Mensaje Individual
  #4 (permalink)  
Antiguo 09/11/2012, 11:00
Avatar de llorcasantana
llorcasantana
 
Fecha de Ingreso: octubre-2012
Mensajes: 45
Antigüedad: 11 años, 6 meses
Puntos: 2
Respuesta: Como realizar un arreglo con registros de myslq

Prueba esto
config.php
Código PHP:
Ver original
  1. <?php
  2.      
  3. $conexio;
  4.     function conectar_bd()
  5.     {
  6.         global $conexio;
  7.         //Definir datos de conexion con el servidor MySQL
  8.         $elUsr = "root";
  9.         $elPw  = "";
  10.         $elServer ="localhost";
  11.         $laBd = "data_base";
  12.          
  13.         //Conectar
  14.         $conexio = mysql_connect($elServer, $elUsr , $elPw) or die (mysql_error());
  15.          
  16.         //Seleccionar la BD a utilizar
  17.         mysql_select_db($laBd, $conexio ) or die (mysql_error());
  18.     }
  19.          
  20. ?>

index.php
Código PHP:
Ver original
  1. <?php
  2. include('config.php');
  3. $q=mysql_query("select * from tabla");
  4. if(mysql_num_rows($q)!='0'){
  5. while($r=mysql_fetch_array($q)){
  6. echo ' '.$r['Nota'].',  ';
  7. }
  8. }
  9. ?>