Jump to content

Falha de registo


Recommended Posts

Porque me devolve ele sempre não???

os campos estão certos...



    $autor = $_POST['autor'];
    $apelido =$_POST['apelido'];
    $titulo = $_POST['titulo'];
    $editora = $_POST['editora'];
    $edicao = $_POST['edicao'];
    $ano =$_POST['ano'];
    $paginas = $_POST['paginas'];
    $descricao = $_POST['descricao'];
    $connect = mysql_connect($server,$user,$pass) or die("Falhou a Ligacao");
    $select_db = mysql_select_db($db);
    $query= "INSERT INTO Autor(Nome,Apelido) VALUES('$autor','$apelido')";
    $do_query = mysql_query($query);
    $autor_id = mysql_insert_id();
    $query2= "INSERT INTO Livro(Titulo,Editora,Edicao,Ano,Paginas,Descricao) VALUES('$titulo','$editora','$edicao','$ano','$paginas','$descricao')";
    $do_query2= mysql_query($query2);
    $book_id = mysql_insert_id();
    $j= mysql_query("INSERT INTO Autoria(Autoria_Livro, Autoria_Autor) VALUES('$autor_id','$book_id')");
    if($j) echo "sim"; else echo "nao";
    if($do_query2) echo "true"; else echo"false";

Devolve true e não, ou seja , só a query de inserir na Autoria é que não está a funcionar ! why ? ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.