PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
function obtener_votos_respuestas () {
global $idvotacion;
for ($x = 1; $x <= 8; $x++){
for ($z = 1; $z <= 11; $z++) {
$query_votos_respuesta = "SELECT contador FROM enc_respuestas WHERE idvotacion='$idvotacion' AND idpregunta='$x' AND idrespuesta='$z'";
$result_votos_respuesta = mysql_query($query_votos_respuesta) or die ("Error in query: $query_votos_respuesta. ".mysql_error());
while ($registro_votos_respuesta = mysql_fetch_row($result_votos_respuesta))
{
$get_contador_respuestaї$x]ї$z] = $registro_votos_respuesta;
}
}
}
return $get_contador_respuesta;
}
Any help would be appreciated... thanks
Last edited by danf_1979 on Mon Feb 21, 2005 6:21 pm, edited 2 times in total.
you're likely to run out of database memory with all those queries flying around.. for instance your function can perform the entire set of queries in one simple query:
UPDATE enc_respuestas SET contador='" . ((int)($obtengo_votos_respuestasї$x]ї$z]ї0] + 1) . "' WHERE (idvotacion='$idvotacion' AND idpregunta='$idpregunta' AND idrespuesta='$idrespuesta'
$query_votos_respuesta = "SELECT contador FROM enc_respuestas WHERE idvotacion='$idvotacion' AND (idpregunta BETWEEN 1 AND 8) AND (idrespuesta BETWEEN 1 AND 11)";