Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/07/2010, 12:24
johhan16
 
Fecha de Ingreso: junio-2010
Ubicación: Venezuela, Zulia
Mensajes: 686
Antigüedad: 13 años, 10 meses
Puntos: 55
Respuesta: Problemas al dar click al boton Votar con PHP y Mysql

prueba asi a ver

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
$link 
mysql_connect('localhost''root''yo2bik');
if (!
$link)
   die(
'Error al conectarse con MySQL: ' mysql_error().' <br>Número del error: '.mysql_errno());
if (! @
mysql_select_db("pintatumundoagatha",$link)){
   echo 
"No se pudo conectar correctamente con la Base de datos";
   exit();
}
?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>

   <br />
   <form id="busca_imagenes" name="busca_imagenes" method="post" action="">
   <fieldset>
  <table width="200" border="0" align="center">
      <tr>
        <td>Nombre Artista</td>
        <td><input type="text" name="nombre_artista" id="nombre_artista" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Colegio</td>
        <td><label for="colegio_artista"></label>
          <input type="text" name="colegio_artista" id="colegio_artista" /></td>
        <td><input type="submit" name="Buscar" id="Buscar" value="Buscar" /></td>
      </tr>
      <tr>
        <td>Curso</td>
        <td><label for="curso_artista"></label>
          <input type="text" name="curso_artista" id="curso_artista" /></td>
        <td>&nbsp;</td>
      </tr>
  </table>
  </fieldset>


<?php

if ($_POST['Buscar'])
{
    
        if (
$_POST['nombre_artista'])
    {
        
$buscar_nombre_artista="select artista.*, pinturas.* from artista, pinturas where artista.id_artista=pinturas.id_artista and artista.nombre_artista='".$_POST['nombre_artista']."' and pinturas.id_artista=artista.id_artista";
        
        
$buscar_nombre_artista mysql_query($buscar_nombre_artista) or die(mysql_error());
                while(
$row=mysql_fetch_assoc($buscar_nombre_artista))
                {
                    echo 
'<center><img src="'.$row['PINTURA_URL'].'"></img></center>';
                    echo 
'<center>Nombre: '.$row['NOMBRE_ARTISTA'].'</center>';
                    echo 
'<center>Curso: '.$row['CURSO_ARTISTA'].'</center>';
                    echo 
'<center>Colegio: '.$row['COLEGIO_ARTISTA'].'</center>';
                    echo 
"<center><input type='submit' name='Votar' value='Votar' /></center>";
                    
//var_dump($row);
                    
$_SESSION['id_pintura']=$row['ID_PINTURA'];
                }
                
                
$ide_pintura $_SESSION['id_pintura'];
                
                echo 
$consulta "SELECT voto FROM votacion WHERE id_pintura='".$ide_pintura."'"
    
$consulta mysql_query($consulta); 
    
$lado=mysql_num_rows($consulta);
    while(
$row_voto mysql_fetch_array($consulta)){ 
        
$votos$row_voto['VOTO'];
        echo 
$row_voto['VOTO'];
        echo 
$votos;
        
//var_dump ($row_voto);
                                                      
}

    }
}                
                if (
$_POST['Votar']) 
                {
                    
?>
        <SCRIPT LANGUAGE="javascript">
        alert('Gracias por Votar');
        </SCRIPT>
                    <?php
                    
                    $votos 
$votos 1;
// actualizo la base de datos
    
echo $consulta "UPDATE votacion SET voto = '".$votos."' WHERE id_pintura='".$ide_pintura."'";
    
mysql_query($consulta,$link);

                }
        

?>
</form>
</body>
</html>