Foros del Web » Programando para Internet » PHP »

Error

Estas en el tema de Error en el foro de PHP en Foros del Web. Soy principiante en la programacion, quiero guardar mi contenido de mi tabla en una matriz. Pero me bota el siguiente error: Warning: mysql() expects at ...
  #1 (permalink)  
Antiguo 27/06/2015, 12:17
 
Fecha de Ingreso: mayo-2015
Ubicación: Manta
Mensajes: 2
Antigüedad: 8 años, 10 meses
Puntos: 0
Pregunta Error

Soy principiante en la programacion, quiero guardar mi contenido de mi tabla en una matriz. Pero me bota el siguiente error:


Warning: mysql() expects at least 2 parameters, 1 given in C:\xampp\htdocs\turingsystemphp\includes\conexiond atos.php on line 17

Notice: Use of undefined constant usuario - assumed 'usuario' in C:\xampp\htdocs\turingsystemphp\includes\conexiond atos.php on line 18

Warning: mysql() expects parameter 3 to be resource, string given in C:\xampp\htdocs\turingsystemphp\includes\conexiond atos.php on line 18

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\turingsystemphp\includes\conexiond atos.php on line 20



Código:
<?php
session_start();
switch ($_SESSION['proceso']){
case (1):
    $ingresousuario = $_POST['user'];
    $contrasena = $_POST['clave'];
    $conexion = mysql_connect("localhost","root","");
    
    if (!$conexion) {
        
        die("No hay conexion MySQL".mysql_error());
        
    }
    
    mysql_select_db("turingsystem",$conexion);
    
    $peticion =  mysql("SELECT * FROM usuario");
    mysql("turingsystem","SELECT* FROM", usuario);
    
    while ($fila=  mysql_fetch_array($peticion)){
        echo $fila['USER_Id']."".$fila['USER_Nivel']."".$fila['USER_Apellido']."".$fila['USER_Correo']."".$fila['USER_Clave'];
        echo'<br>';
    }
  #2 (permalink)  
Antiguo 27/06/2015, 12:38
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Error

usa este codigo y adaptalo a tu base:

Código PHP:
Ver original
  1. <?php
  2. $data = new MySQLi(HOST, USUARIO, PASS, BASE);
  3. $fecha = $data->query("SELECT * FROM cronograma_cursos");
  4. $row_fecha = $fecha->fetch_assoc();
  5. $totalRows_fecha = mysqli_num_rows($fecha);
  6.  
  7. if(mysqli_num_rows($fecha)>0)
  8. {
  9. while($row = mysqli_fetch_assoc($fecha))
  10. {
  11.  
  12.     echo $fila['USER_Id']."".$fila['USER_Nivel']."".$fila['USER_Apellido']."".$fila['USER_Correo']."".$fila['USER_Clave'];
  13.         echo'<br>';
  14. }
  15.  
  16. }
  17. ?>

Etiquetas: apache, mysql, netbeans, xampp
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:53.