Una duda...
Tengo un script en el cuál, un visitante puede subir una imagen a una determinada carpeta de mi host.
Y en la base de datos se crea el nombre de la imagen que se ha añadido, junto a la fecha, y el id.
Código PHP:
   CREATE TABLE `noticias` (
`id` TINYINT NOT NULL AUTO_INCREMENT ,
`titulo` VARCHAR( 80 ) NOT NULL ,
`mensaje` TEXT NOT NULL ,
`foto` VARCHAR( 100 ) NOT NULL ,
`fecha` VARCHAR( 20 ) NOT NULL ,
  `hits` int(11) NOT NULL default '0', 
  `rating` int(11) NOT NULL default '0', 
  `nrofvotes` int(11) NOT NULL default '0', 
PRIMARY KEY ( `id` ) 
); 
    Para votar utilizo el siguient script:
VOTAR.php
Código PHP:
   <?php 
include("config.php");
 
mysql_query("UPDATE noticias SET rating = rating + ".$_GET['score'].", nrofvotes = nrofvotes + 1 WHERE id = ".$_GET['gid']."")  or die(mysql_error());   
 
echo "<html>
        <title>TITULO</title>
        <BODY>Gracias por tu voto.
        </BODY></HTML>";
?>    Código HTML:
 <form action='votar.php' method='get' > <input name='gid' value='".$_GET['gid']."' type='hidden'> <input name='score' value='1' onclick='this.form.submit()' type='radio'>1 <input name='score' value='2' onclick='this.form.submit()' type='radio'>2 <input name='score' value='3' onclick='this.form.submit()' type='radio'>3 </form>
Gracias de antemano.
Saludos desde Barcelona
NOTA: Aunque mi base de datos se llama noticias... no importa, se deberia llamar imagenes
 
Este tema le ha gustado a 1 personas