-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport-csv.php
124 lines (117 loc) · 6.18 KB
/
export-csv.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
/*
* @author Shahrukh Khan
* @website http://www.thesoftwareguy.in
* @facebbok https://www.facebook.com/Thesoftwareguy7
* @twitter https://twitter.com/thesoftwareguy7
* @googleplus https://plus.google.com/+thesoftwareguyIn
*/
require_once("configure.php");
?>
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="http://www.thesoftwareguy.in/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Import and Export CSV with PHP And MySql - thesoftwareguy</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="body">
<div class="mainTitle" >Export CSV with PHP And MySql</div>
<div style="text-align:center;">
<a href="import-csv.php" title="Import CSV" ><img src="buttons/button_import.png" alt="Import CSV" width="151" height="38"> </a>
<a href="export-csv.php" title="Export CSV" ><img src="buttons/button_export.png" alt="Export CSV" width="148" height="38"> </a>
</div>
<div class="height10"></div>
<div class="height10"></div>
<div style="text-align:center;">
<a href="export.php" title="Export The table" ><img src="buttons/button_export_table.png" alt="Export The table" width="229" height="38"></a>
</div>
<article>
<table class="bordered" >
<thead>
<tr>
<th style="font-weight:bold;text-align:left;">Name</th>
<th style="width:10%;text-align:center;font-weight:bold;">Quantity</th>
<th style="width:15%;text-align:center;font-weight:bold;">Model</th>
<th style="width:15%;text-align:center;font-weight:bold;">Price</th>
<th style="width:15%;text-align:center;font-weight:bold;">Weight</th>
<th style="width:15%;text-align:center;font-weight:bold;">Status</th>
</tr>
<?php
$sql = "SELECT * FROM tbl_products1 WHERE 1";
try {
$stmt = $DB->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
} catch (Exception $ex) {
printErrorMessage($ex->getMessage());
}
// display all products
foreach ($results as $rs) {
?>
<tr>
<td><?php echo stripslashes($rs["products_name"]) ?></td>
<td style="text-align:center"><?php echo stripslashes($rs["products_quantity"]) ?></td>
<td style="text-align:center;"><?php echo stripslashes($rs["products_model"]) ?></td>
<td style="text-align:center;"><?php echo stripslashes($rs["products_price"]) ?></td>
<td style="text-align:center;"><?php echo stripslashes($rs["products_weight"]) ?></td>
<td style="text-align:center;"><?php echo ($rs["products_status"] == "A") ? "Active" : "Inactive"; ?></td>
</tr>
<?php
}
?>
</thead>
</table>
<div class="height10"></div>
</article>
<div style="margin:10px 0;width:100%;float: left;">
<div style="width:35%;float: left;margin:0 auto;text-align: center;">
<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FThesoftwareguy7&width&height=360&colorscheme=light&show_faces=true&header=true&stream=false&show_border=true&appId=198210627014732" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:360px;" allowTransparency="true"></iframe>
</div>
<div style="width:35%;float: left;margin:0 auto;text-align: center;">
<!-- Place this tag where you want the widget to render. -->
<div class="g-person" data-href="https://plus.google.com/116523474604785207782" data-rel="author" data-layout="potrait"></div>
<!-- Place this tag after the last widget tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
</div>
<div style="width:30%;float: left;margin:0 auto;text-align: center;">
<a class="twitter-follow-button"
href="https://twitter.com/thesoftwareguy7"
data-show-count="true"
data-lang="en" data-size="large" >
Follow @thesoftwareguy7
</a>
<script type="text/javascript">
window.twttr = (function (d, s, id) {
var t, js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src= "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
return window.twttr || (t = { _e: [], ready: function (f) { t._e.push(f) } });
}(document, "script", "twitter-wjs"));
</script>
</div>
</div>
<div class="height10"></div>
<footer>
<div class="copyright">
© 2013 <a href="http://www.thesoftwareguy.in" target="_blank">thesoftwareguy</a>. All rights reserved
</div>
<div class="footerlogo"><a href="http://www.thesoftwareguy.in" target="_blank"><img src="http://www.thesoftwareguy.in/thesoftwareguy-logo-small.png " width="200" height="47" alt="thesoftwareguy logo" /></a> </div>
</footer>
</div></div>
</body>
</html>