ok
Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/add-api/ |
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/add-api/add-current_affairs-form.php |
<?php include "../config/config.php"; error_log("venkat"); if($_POST['type']=='add_question'){ error_log("inside if condition"); try{ $date = date("Y-m-d"); for($i=0;$i<count($_POST['question']);$i++){ if($_FILES['photo']["name"][$i]!=""){ $file_name = $_FILES['photo']['name'][$i]; $tmp = explode('.', $file_name); $extension = end($tmp); //$extension = end(explode(".", $_FILES["photo"]["name"][$i])); $image = rand(10,1000000000)."-".$date."-org_signature." . $extension; $upload = move_uploaded_file($_FILES['photo']['tmp_name'][$i], '../upload/image/' . $image); $banner = 'upload/image/' . $image; } $question = $_POST['question'][$i]; $option_a = $_POST['option_a'][$i]; error_log($option_a); $option_b = $_POST['option_b'][$i]; $option_c = $_POST['option_c'][$i]; $option_d = $_POST['option_d'][$i]; $answer = $_POST['answer'][$i]; $explanation = $_POST['explanation'][$i]; $video = $_POST['video'][$i]; //$image = $banner[$i]; $statement = $pdo->prepare("INSERT INTO `tbl_current_affairs`(`questions`,`option_a`,`option_b`,`option_c`,`option_d`,`explanation`,`correct_answer`,`video_link`,`image`) VALUES (?,?,?,?,?,?,?,?,?)"); $result=$statement->execute(array($question,$option_a,$option_b,$option_c,$option_d,$explanation,$answer,$video,$banner)); } }catch(Exception $e){ $error=$e; } } ?>