Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/09/2009, 13:14
Xbio
 
Fecha de Ingreso: septiembre-2009
Mensajes: 20
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Obtener valor de un campo

He probado de quitar el null, y sin eso no me lo coje.

Voy a poner todo el codigo a ver si no lio tanto
Código PHP:
<?php


$basedatos 
"test";
$titulohtmlentities($_GET["titulo"]);
$autorhtmlentities($_GET["autor"]);
$editorialhtmlentities($_GET["editorial"]);
$isbnhtmlentities($_GET["isbn"]);
$preciohtmlentities($_GET["precio"]);

$sql "insert into libros values (null,'$titulo','$editorial','$isbn','$precio')";
$sql2 ="insert into autores values (null,'$sql3','$autor')";//es este $sql3 donde quiero que su valor sea el de id_libro(que es un auto_increment y por lo tanto se asigna automaticamente)
$sql3 ="select libros.id_libro from libros where titulo = '$titulo'";

mysql_connect("localhost""root""prueba"); 
mysql_select_db("test"); 


 
$consulta="SELECT * FROM libros WHERE isbn='$isbn'";

$resultado=mysql_query($consulta) or die (mysql_error()); 

if (
mysql_num_rows($resultado) == 0


$result mysql_query($sql);
$result2 mysql_query($sql2);

if (!
$result && !$result2) {
    die(
"<h2 align='center'>No se ha podido crear la tabla mysql</h2>".mysql_error());
}else{

echo (
'<table width="390" border="0">
  <tr>
    <td width="384"><strong><u>El libro ha sido introducido correctamente, gracias.</u></strong></td>
  </tr>
</table>
<table width="390" border="0">
  <tr>
    <td width="384">¿Que desea hacer?</td>
  </tr>
</table>
<table width="317" border="1">
  <tr>
    <td width="145" align="center"><strong>Ir a inicio</strong></td>
    <td width="162" align="center" valign="bottom">'
);
echo
"<a href=\"javascript:history.back()\" ><strong>Introducir otro libro</strong></a></td>
  </tr>
</table>
"
;





}else{
    echo 
"<b>Error:</b> El libro introducido ya existe en nuestra base de datos, por favor introduzca otro ";
    echo 
"<a href=\"javascript:history.back()\">Regresar</a>";
}
?>
Gracias por contestar