Good evening, I need to ask a question system exactly like this: link
I just need as many questions and answer options as come from the bank. I tried this way only the radios are coming out empty, plus the query is ok, and running it in MySQL it correctly returns the data, I think it might be something with the loop's, could someone help me to find the error?:
Following code:
<?php
//CONEXÃO
$servername = "127.0.0.1"; $username = "root"; $password = "root"; $dbname = "master";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//CONEXÃO
$QPergunta = "SELECT sug_perg_id AS ID_PERGUNTA, sug_perg_pergunta AS PERGUNTA FROM sugestoes_perguntas WHERE sug_perg_area = 3";
$QAvalicao = "SELECT sug_aval_id AS ID_AVALIACAO, sug_aval_desc AS DESCRICAO FROM sugestoes_avaliacao";
$RPergunta = $conn->query($QPergunta);
$RAvaliacao = $conn->query($sql);
while($row = $RPergunta->fetch_assoc()){
echo "PERGUNTA :".$row["PERGUNTA"];
echo"<br>";
while($row = $RAvaliacao->fetch_assoc()){
echo"<input type='radio' name='".$row["ID_PERGUNTA"]."' value='".$row["ID_AVALIACAO"]."'>".$row["DESCRICAO"];
echo"<br>";
}
}
//FINALIZA CONEXÃO
$conn->close();
//FINALIZA CONEXÃO
?>