function answerPost() { global $db; $a = new Answer(); echo "\nEnter the title of posted question\n"; $a->quesTitle = trim(fgets(STDIN)); echo "Enter the answer of Question\n"; $a->comment = trim(fgets(STDIN)); if ($a->postAnswer($db)) { echo "\n Answer has been posted successfully\n"; } else { echo "\n Try again :(\n "; } }