Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/06/2012, 15:39
jbrian320
 
Fecha de Ingreso: mayo-2012
Mensajes: 8
Antigüedad: 11 años, 11 meses
Puntos: 0
Problemas con Insert Into

Hola a todos, soy nuevo en mysql y php, en este momento tengo un problema (Que antes no sucedia, y no recuerdo haber modificado algo q pudiera haber hecho q falle, seguramente lo hice, pero no lo recuerdo). El problema es el siguiente, tengo un boton que hace referncia al php donde se hace el insert into.

Antes insertaba los datos sin ningun problema, pero ahora no, solo los inserta si es que ya hay datos anteriores con el id del usuario.

Código PHP:
<?php
session_start
(); //Inicio de Sesion
include "../config.php";

$username $_COOKIE['loggedin'];
if (!isset(
$_COOKIE['loggedin'])) die("No has iniciado sesión, <a href=login.html>click aquí</a> para identificarte.");

mysql_connect($server$db_user$db_pass) or die (mysql_error()); 

$aid $_GET['aid']; //Obtener id de serie

$img $_GET['img']; //Obtener imagen de serie

$url $_GET['url']; //Obtener url de serie

$name $_GET['name']; //Obtener nombre de serie

mysql_select_db($database)
or die (
"Could not select database because ".mysql_error());


if(
$_SESSION[user]==true) { //Si esta logeado agregar
    
$fav mysql_db_query($database"select id from ac_users WHERE username = '$username'") or die (mysql_error());
$idfav mysql_fetch_array($fav);
$result mysql_db_query($database"select url,img,titulo,id_serie from series WHERE id_user = '$idfav[id]' limit 1") or die (mysql_error());

   while (
$qry mysql_fetch_array($result)) { 
      
mysql_query("INSERT INTO series VALUES('$aid','$idfav[id]','$name','$img','$url')"); }

}
else {
    echo 
"No has iniciado sesión, <a href=login.html>click aquí</a> para identificarte.";
}
?>
Espero que me puedan ayudar, muchas gracias!