Jump to content
php.lv forumi

mysql.php> xls(excel)


edi

Recommended Posts

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Kaut kā šitā

$lines = array();
$sql = "SELECT col1, col2, col3 FROM `tabula`";
$res = mysql_query($sql)or die(mysql_error());
while($row = mysql_fetch_array($res, MYSQL_NUM)){
$lines[] = implode("\t", array_values($row));
}
file_put_contents('fails.xls', implode("\n", $lines));

Link to comment
Share on other sites

Kaut kā šitā

$lines = array();
$sql = "SELECT col1, col2, col3 FROM `tabula`";
$res = mysql_query($sql)or die(mysql_error());
while($row = mysql_fetch_array($res, MYSQL_NUM)){
$lines[] = implode("\t", array_values($row));
}
file_put_contents('fails.xls', implode("\n", $lines));

strāda)) thq

-----

kā lai izvada linku uz failu tajā pašā lapā? :D

Edited by edi
Link to comment
Share on other sites

var kaut kā pirms datiem no datubāzes ielikt tekstu?

iemacies pamatus !!!!

php failaa skriptaa tiiru tekstu izvada:

1. KA TIIRU TEKSTU BEZ <?php un ?>

2. ar echo paliidzibu

3. ar print() paliidzibu

--

tatad varjanti

mans teksts bla bla bla , tai skaita HTML kods
<?php
echo 'Sheit atrodas php kods';
?>
te atkal textc
<?php
print("TE ARII VAR IZVADIIT TEKSTu");
?>

Link to comment
Share on other sites

iemacies pamatus !!!!

php failaa skriptaa tiiru tekstu izvada:

1. KA TIIRU TEKSTU BEZ <?php un ?>

2. ar echo paliidzibu

3. ar print() paliidzibu

--

tatad varjanti

mans teksts bla bla bla , tai skaita HTML kods
<?php
echo 'Sheit atrodas php kods';
?>
te atkal textc
<?php
print("TE ARII VAR IZVADIIT TEKSTu");
?>

kad atver failu ar exceli vins garumzimju vieta rada keburus )

P.S es domāju par to tekstu xls faila :)

Edited by edi
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...