Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/11/2008, 14:42
iozk
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 16 años
Puntos: 1
Pregunta error en mi codigo ¿!?

hol a tengo un error con esto no se que este mal

¿ podrian ayudarme?

dice
Column count doesn't match value count at row 1

Código PHP:
<?php
    mysql_connect
("localhost""root""iozk2010");
    
mysql_select_db("videodb") or die (mysql_error());
?>

<form method="post" action="index.php">
    <table border="0" style="font-size:15px; font-family:tahoma; border:1px solid black;">
        <tr><td>
            username:
        </td><td>
            <input type="username" name="username" value="<?php echo $_POST['username'];?>"/>
        </td></tr>
        <tr><td>
            password:
        </td><td>
            <input type="password" name="password" value="<?php echo $_POST['password'];?>"/>
        </td></tr>
        <tr><td>
            menssage:
        </td><td>
            <input type="text" name="message" value="<?php echo $_POST['message'];?>"/>
        </td></tr>
        <tr><td colspan="2" align="center">
            <input type="submit" name="submit" value="submit"/>
        </td></tr>
    </table>
</form>

<?php
if($_POST['submit']){
    
$username $_POST['username'];
    
$password $_POST['password'];
    
$message $_POST['message'];
    
    
$curnum 0;
    
  if(!
$username){
    
$curnum ++;
    echo
"<font color='red'".$curnum."¡no has puesto tu nombre de usuario!</font><br>\n";
  }
  
  if(!
$password){
    
$curnum ++;
    echo
"<font color='red'".$curnum."¡no has puesto tu password!</font><br>\n";
  }
  
  if(!
$message){
    
$curnum ++;
    echo
"<font color='red'".$curnum."¡no has escrito tu mensaje!</font><br>\n";
  }
  
  
$sql "SELECT * FROM tabla WHERE username='".$username."'";
  
$res mysql_query($sql) or die (mysql_error());
  
  if(
mysql_num_rows($res) > 0) {
   
$curnum ++;
   echo 
"<font color='red'>".$curnum.".El usuario'".$username."' ya existe!</font><br>\n";
  }
  
  if(
$curnum == 0){
   
mysql_query("INSERT INTO tabla VALUES(`id`,'".$username."', '".$password."', '".$message."')") or die (mysql_error());
   
   echo
"<font color='green'>tu mensage ha sido enviado con exito con el nombre de '<br>".$username."</br>'</font>\n";
  }
}
?>