0

what i wanted is to create attributes depending on the value of $numOfQuestion and $numofChoices;

$numOfQuestion = 5;
$numofChoices = 4;

$calculatedchoices = $numOfQuestion * $numofChoices; 

                $sql123 = 
                "CREATE TABLE '" . $course_name . "'(
                    id INT(255) PRIMARY KEY AUTO_INCREMENT,
                    course_id INT(255),
                    student_id INT(255),"

                for($i = 1; i <= $numofQuestion; i++){
                    "QH '" . $i . "' VARCHAR(255),"
                }
                for($a = 1; a <= $calculatedchoices; a++){
                    "CH '" . $a . "' VARCHAR(255),"
                }
                    "date_added date NOT NULL,
                    time_added VARCHAR(255) NOT NULL
                )";
                mysqli_query($conn, $sql123);

erro in the console: Parse error: syntax error, unexpected 'for' (T_FOR) in C:\xampp\htdocs\test\admin\course_add_process.php on line 66

0 Answers0