require('database_connectivity.php');
Header('Content-type: application/csv');
Header("Content-disposition: attachment; filename=\"Competitions-".date('mdy-Hi').".csv\"");
//Fetching the Question for "exam_question" table
$sql_exam_question = "SELECT user.user_name, user.user_email, user.user_qno, user.optionid, optn.option_text,
user.user_date, ques.ques_text, ques.ques_prize_text
FROM competition_user AS user, exam_question AS ques, competition_options AS optn
WHERE user.user_qno = ques.question_id AND user.user_qno = optn.competition_qno
AND user.optionid = optn.optionid ";
$qry_exam_question = mysql_query($sql_exam_question) or die();
$column_limiter = ",";
$row_limiter = "\n";
//Heading
echo "Name,Email,Question No.,Answer,Question,Prize,Date\n";
while( $fetch_data = mysql_fetch_object($qry_exam_question) ) {
echo $fetch_data->user_name; echo $column_limiter;
echo $fetch_data->user_email; echo $column_limiter;
echo $fetch_data->user_qno; echo $column_limiter;
echo $fetch_data->option_text; echo $column_limiter;
echo $fetch_data->ques_text; echo $column_limiter;
echo $fetch_data->ques_prize_text; echo $column_limiter;
echo $fetch_data->user_date; echo $column_limiter;
echo $row_limiter;
}
?>
Subscribe to:
Post Comments (Atom)
Popular Posts
-
1. How old PHP language is? - PHP began in 1994, so 14 years old. 2. What are different names of PHP? - PHP originally stood for Persona...
-
HTML: a. HTML is a markup language that is used to build static (non interactive and nonanimated) webpages. b. HTML is Case-Insensitive. So...
-
A payment gateway is an e-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks...
-
Note : This is not a perfect sort order, we have just displaying the list of PHP companies. 1. Photon Infotech No. 2/102, Arvind IT Park (N...
-
- count() -- Count elements in a variable - syntax for count() [int count ( mixed var [, int mode])] - If the optional mode parameter is set...
-
Hai all, Simple show hide sample using Show/Hide? Simple Show/Hide code
-
Sharing PHP, MySQL, Javascript, CSS Knowledge, We can share our PHP knowledge on the basis of PHP versioning, Javascript, AJAX, Stylesheet, ...
-
Use the below code and you can get the exact value in php as us saw in browser. Code: $encode_data = iconv('UTF-8', 'windows-125...
-
Download and Enjoy!
-
A hyperlink is a text or a image that you can click on, and move from one page to another web page. Syntax: < a href= "web pag...
1 comment:
Post a Comment