El problema es que cuando uso la funcion mysql_query me devuelve un error de base de datos no seleccionada, y si uso mysql_db_query lo que me devuelve no me sirve para nada.
Asi que no sé que hacer, en el mysql tengo instaladas 3 bases de datos, y solo quiero acceder a una.
El código es el siguiente, me puede decir alquien que estoy haciendo mal y que puedo hacer para solucionarlo? muchisimas gracias por adelantado.
Código:
include ("../prc_config.php"); function nuevo_cine() { //COPIAR FICHERO $nue_nombre = ucwords($_REQUEST['nombre']); $nue_ubi = ucwords ($_REQUEST['ubicacion']); $i = "insert into prc_cine (nombre, ubicacion, plano) values ('" . $nue_nombre . "','" . $nue_ubi . "','" . $_REQUEST['plano'] . "')"; $id_c = "select id from prc_cine where nombre = '" . $nue_nombre ."'"; //comprobamos que no este el nombre //$res = mysql_db_query($db,$id_c,$cdb); $res = mysql_query($id_c,$cdb); if (!$res) { echo "<html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <link href=\"../estilo.css\" rel=\"stylesheet\" type=\"text/css\"> </head> <body> <table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\" class=\"tableb\"> <tr><td> <h3 align=\"center\">La operaciónnnn no ha podido ser terminada por el siguiente error:" . mysql_error($cdb) . "</h3> </td></tr></table> </body> </html>"; exit(); } else{ while ($id_f = mysql_fetch_array ($res, MYSQL_ASSOC)){ if ($id_f['id'] > 0){$cont = $cont + 1;} } if ($cont > 0){ echo "<html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <link href=\"../estilo.css\" rel=\"stylesheet\" type=\"text/css\"> </head> <body> <table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\" class=\"tableb\"> <tr><td> <h3 align=\"center\">El nombre introducido ya existe.</h3> </td></tr></table> </body> </html>"; //exit(); } elseif (!$result = mysql_db_query($db,$i,$cdb)) { echo "<html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <link href=\"../estilo.css\" rel=\"stylesheet\" type=\"text/css\"> </head> <body> <table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\" class=\"tableb\"> <tr><td> <h3 align=\"center\">La operación no ha podido ser terminada por el siguiente error:" . mysql_error($cdb) . "</h3> </td></tr></table> </body> </html>"; //exit(); } else { $var = $id_f['id']; $s = crear_sala($var); if ($s == 1){ echo "<html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <link href=\"../estilo.css\" rel=\"stylesheet\" type=\"text/css\"> </head> <body> <table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\" class=\"tableb\"> <tr><td> <h3 align=\"center\">La operación se ha creado con éxito, se creó el cine con sus 9 salas y sus butacas.</h3> </td></tr></table> </body> </html>"; } } } }