Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/03/2010, 08:35
auska1714
 
Fecha de Ingreso: enero-2008
Mensajes: 9
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Problemas al procesar informacion php-mysql

El código, una vez arreglado un par de errores que tenia es este. El promblema sigue siendo que no introduce los valores a la tabla...

Código PHP:
<HTML>
<HEAD>
    <TITLE></TITLE>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
</HEAD>
<BODY bgcolor="Black">
<font color="White">
<?php
include ('plantilles.php');
print (
capsalera());
?>
<font color="White">Emplena els caps refarents al llibre a entrar:</font>
<br>
<?
function form()
{
echo 
"<font color=\"White\"><b>
<FORM method=\"POST\">
Títol:
<input type=\"text\" name=\"titol\"><br>
Autor: 
<input type=\"text\" name=\"autor\"><br>
Descripció:
<input type=\"text\" name=\"descripcio\"><br>
Cedit per:
<input type=\"text\" name=\"cedit\"><br>
<input type=\"submit\" value=\"Enviar\">"
;
}
?>
<BR> 
<?
function administ()
{
   if ((
$sTitol =='') or ($sDescripcio  =='') or ($sAutor  ==''))
  {
    return 
true;
  }else{
    return 
false;
  }
}

function 
base()
{
$pParametres FALSE;
if (
count($_GET) != 0) {
    
$pParametres $_GET;
}elseif (
count($_POST) != 0) {
    
$pParametres $_POST;
}
if (
pParametros != FALSE) {
    
$sTitol $pParametres['titol'];
    
$sDescripcio $pParametres['descripcio'];
    
$sAutor $pParametres['autor'];
    
$sCedit $pParametres['cedit'];
    if ((
$sTitol =='') or ($sDescripcio  =='') or ($sAutor  =='')){
        
$sMisatge 'El nombre, la descripció i l\'autor no poden quedar buits.';
        echo 
$sMisatge;
    } 

}else {
        
$sConsulta "CONSULTA
        INSERT INTO llibres (
            titol,
            descripcio,
            autor,
            cedit
            ) VALUES (
                '$sTitol',
                '$sDescripcio',
                '$sAutor',
                '$sCedit'
            );
            CONSULTA"
;
            
$llibreria = new mysqli('localhost''root''''llibreria_ateneu');
            if (
$llibreria == FALSE){
                echo (
'Error en la conexió.');
                exit();
            }
            
$resultat $llibreria->query($sConsulta);
            
            if (
$resultat == FALSE) {
                echo (
'Error a la consulta.');
                echo (
$llibreria->error);
                exit();
            }
            echo (
'Nou llibre afegit.'), "<hr />";
            
            
            
$llibreria->close();
}}

if(
administ())
{
 
form();
}
else
{
    
base();
}
?>    

</BODY>
</HTML>