2014-10-07 - CSV from Mysql Database ??? example

Header Data

From: bartosz <ba***z@miklaszewski.com>
Message Hash: 50d6526c75b7b09d7284b55d4460a6ace150f25666fcb96343ac4f872486f083
Message ID: <9f92baa2-d4ad-4104-826a-ee7975da07ed@grasehotspot.org>
Reply To: N/A
UTC Datetime: 2014-10-07 16:35:29 UTC
Raw Date: Tue, 07 Oct 2014 16:35:29 -0700

Raw message

hi guys just been messing around, after Tim mention about CSS and HTML 
tickets, looks it will be very good idea :)
tried my self. For example, in batch list, to add option to print to html, 
(and html will get batch from mysql and print in html formated with css, 
this is what i did to test it: (no CSS yet)

database imported from csv to mysql:

<https://lh4.googleusercontent.com/-nC9p9JC99Ew/VDR389hEvHI/AAAAAAAAKqU/pSxLtuCegjY/s1600/Screenshot%2Bfrom%2B2014-10-08%2B00%3A27%3A09.png>

then:

<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
  die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT username, password, expiry, type FROM barttable';

mysql_select_db('bart');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
    echo "Username:{$row['username']}  <br> ".
         "Password: {$row['password']} <br> ".
         "Expiry: {$row['expiry']} <br> ".
         "Type: {$row['type']} <br> ".
         "--------------------------------<br>";
} 
echo "Fetched data successfully\n";

mysql_close($conn);
?>

as a resault html file:

Username:Username 
Password: Password 
Expiry: Expiry 
Type: Voucher Type 
--------------------------------
Username:6fe6leud 
Password: tunbad333 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:un89heuf 
Password: fac898low 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:9te8novi 
Password: givhek355 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:og49buaw 
Password: bej148lil 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:as9ab2ga 
Password: daknub488 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:uf8og4ro 
Password: tuwcar795 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ek1ap2ep 
Password: ticsek284 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:5ti2keak 
Password: wacpam438 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:1lo5zoor 
Password: hac667mad 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:1coug5bu 
Password: mak684wiz 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:5riad7ob 
Password: nup595gun 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:3cu6vame 
Password: nid513nas 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:2maov6en 
Password: vajtoj659 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:1ni6cois 
Password: natgim934 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ak2un3jo 
Password: votkaf845 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:5di9hoaj 
Password: hop196nas 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:6beet2wo 
Password: roctan497 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:in8iz1up 
Password: dimpit883 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:6se6heje 
Password: lus768mom 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:uk24fooz 
Password: firroz295 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ev57wawi 
Password: mop342bih 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ej6er7pi 
Password: kam216car 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:8soer9ub 
Password: ridzev463 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ak8ol6ok 
Password: kot168cid 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ud7ir1uk 
Password: duhvol958 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ir3ol1uc 
Password: jenref625 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:an5og5nu 
Password: hippek985 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:if77gate 
Password: den211fir 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:2te1buod 
Password: salcad749 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:4dauf9fo 
Password: vic341mow 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:or67juec 
Password: jalsuh783 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:3mu9moiz 
Password: zam836fur 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:3riiv3uw 
Password: zut162sug 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:of15boad 
Password: degbok574 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:el2id8al 
Password: zim358jep 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:6mu5jait 
Password: tok513zot 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:od49situ 
Password: lan627bob 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:im6af1ew 
Password: buzzez417 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:ut79maik 
Password: topfav469 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:3keup5id 
Password: cow667muc 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:6bo4nuwu 
Password: moz751vaj 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:aj67fuih 
Password: fad159gen 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:iz71veko 
Password: cij589wek 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:4no1jewa 
Password: bis936nej 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:8vaez8ke 
Password: zofked267 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:is6ip7is 
Password: mit914sim 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:1ca5jolo 
Password: doh365tim 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:an6af8af 
Password: cobdut136 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:4puac5pu 
Password: tor527hub 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Username:5ma3pead 
Password: nuc552moc 
Expiry: Apr 7 2015 01:49:51 
Type: Ministry 
--------------------------------
Fetched data successfully 


will try to play with css now will see what happen :)

what you think ? :)












Thread