funciones.php:
Código PHP:
function votar() {
$valor = $_POST['valor'];
$id = $_POST['key'];
$n = 1;
$link = mysql_connect("localhost", "enric", "enric") or die(mysql_error());
mysql_select_db("votex", $link) or die(mysql_error());
$key = mysql_query("SELECT `".$valor."` FROM `muro` WHERE `id` LIKE ".$id,$link);
$row = mysql_fetch_object($key);
$num = $row->$valor;
$result = mysql_query("UPDATE `muro`.`".$valor."` SET `".$valor."` = `".$num."` + ".$n." WHERE `id` LIKE ".$id, $link) or die(mysql_error());
mysql_close();
header("location: javascript:go(-1);");
}
Código HTML:
<?php echo'<form action="muro/votar.php" method="post" name="form1"><input type="hidden" name="id" value="'.$key.'"><input type="hidden" name="valor" value="pos"><input type="image" src="objetos/pos.gif"></form>'
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\www\muro\funciones_muro.php on line 286
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
A que se pueden deber?
Gracias por adelantado
EDIT: Solucioné el primer error... pero el segundo aun sigue ahi