Im trying to take make a loop to show one question that is stored in the database on the webpage at a time. Then with a button it will go to the next question and so forth.
<?php
$dbServername = ;
$dbUsername = ;
$dbPassword = ;
$dbName = ;
$conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
$sql = "SELECT * FROM `Questionnaire_Questions_Choices` WHERE 1";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo $row['questionnaire_name'] . "  ";
echo $row['questionnaire_purpose'] . " Question ";
echo $row['question_nbr'] . ". ";
echo $row['question_text'] . " Choice ";
echo $row['choice_nbr'] . " ";
echo $row['choice_text'] . "  ";
echo $row['personality_category'] . "  ";
echo $row['personality_trait'] . "  ";
echo $row['personality_points'] . "<br>";
}
}
?>
this code is currently showing all of the data in the questionnaire database. I want to make a loop to show only one question and its choices at a time with a button to go to the next question. just don't know where to start.
... WHERE question_nbr = 1
. From there, follow a tutorial or two on forms and passing the next question ID. - waterloomatt