Ver Mensaje Individual
  #8 (permalink)  
Antiguo 07/07/2010, 15:13
Avatar de shakaran
shakaran
 
Fecha de Ingreso: agosto-2005
Ubicación: España - Ciudad Real
Mensajes: 374
Antigüedad: 18 años, 8 meses
Puntos: 7
Respuesta: Problema con sistema de votacion

Te pongo aqui el codigo bien puesto, fijate que hay muchas cosas corregidas.

Código PHP:
Ver original
  1. <?php
  2. $conexion = mysql_connect ("localhost", "admin", "") or die (mysql_error());
  3.  
  4. if ($_POST['voto'])
  5. {
  6.     $res = mysql_query ("SELECT Id_noticias FROM noticiasWHERE Id_noticias LIMIT 1", $conexion);
  7.     $row = mysql_fetch_array ($res);
  8.     $sumavotos = mysql_query ("update noticias set voto=voto+1 where Id_noticias='".$row['Id_noticias']."'", $conexion);
  9.     header ("location: index.php");
  10.     mysql_close ($conexion);
  11. }
  12. ?>

PD: Se puede mejorar y afinar mucho mas ;)
__________________
Quijost Backend Engineer - www.quijost.com - Hosting rápido, eficiente y profesional
Blog: www.shakaran.net