![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
Tabla db:
CREATE TABLE `valoraciones` (
`id_noticia` int(9) NOT NULL default '0',
`num_votos` int(20) NOT NULL default '0',
`ptos` int(20) NOT NULL default '0'
) TYPE=MyISAM;
Código fuente:
<?PHP
#####CONEXIÓN A MYSQL
@mysql_connect('localhost','usuario','pass')or die ('Ha fallado la conexión: '.mysql_error());
@mysql_select_db('base_de_datos')or die ('Error al seleccionar la BD: '.mysql_error());
////end conexión
$SSQL_=mysql_query("SELECT * FROM valoraciones WHERE id_noticia='".$_GET[id]."'")or die(mysql_error());
$array_d=mysql_fetch_array($SSQL_);
$valoracioN_total=@round($array_d[ptos]/$array_d[num_votos],2);
if(isset($_POST[valor])){
if(mysql_num_rows($SSQL_)==0){
@mysql_query("INSERT INTO valoraciones VALUES('".$_GET[id]."','1','".$_POST[valor]."')")or die ('ERROR AL INSERTAR REGISTRO: '.mysql_error());
}else{
@mysql_query("UPDATE valoraciones SET num_votos=num_votos+1,ptos=ptos+".$_POST[valor]." WHERE id_noticia='".$_GET[id]."'")or die ('ERROR AL MODIFICAR REGISTRO: '.mysql_error());
}
header('Location:'.$REQUEST_URI);
exit;
}
echo '<strong>Valoración Media : '.$valoracioN_total.'</strong> <div style="background-color:#EFEFEF; width:50px"><img width="'.($valoracioN_total*5).'" height="6" style="background-color: #000099"></div> <br>Total de votos: '.$array_d[num_votos];
?><hr>
<form action="<? echo $REQUEST_URI;?>" method="post">
Nueva valoración:
<select name="valor" id="valor">
<? for ($i=1; $i<=10 ; $i++) echo '<option value="'.$i.'">'.$i.'</option>';?>
</select>
<input type="submit" value="Votar por este artículo">
</form>
![Pensando](http://static.forosdelweb.com/fdwtheme/images/smilies/scratchchin.gif)
Ha fallado la conexión: Access denied for user: 'blabla@blablalb(Using password: YES)
¿Alguien me puede ayudar a solucionar este problema?