473,378 Members | 1,207 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

New line Create in txt file use to file syntax

57
Sir

I create a file and all date save in txt file. i need 2nd data show in next line or line break but line break doesn't work in txt Format. please help me.
[PHP]<?
$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$sl=1;
$Cur_Trns_Dt = date('Y-m-d');
?>
<?
$br = "\n";

$spr = ";";
$sql = "SELECT * FROM `stu_info` WHERE age=25 ORDER BY id ASC";
$result=mysql_query($sql)or die(mysql_error());
$i=1;

while($row=mysql_fetch_array($result))
{

$id=$row['id'];
$Name=$row['name'];
$Age=$row['age'];
$Address=$row['address'];

//WRITE DATA
fwrite($fh, $id);
fwrite($fh, $spr);
fwrite($fh, $Name);
fwrite($fh, $spr);
fwrite($fh, $Age);
fwrite($fh, $spr);
fwrite($fh, $Address);
fwrite($fh, $br);

$i++;
}
?>
<?
fclose($fh);
?>[/PHP]
Thanks Noorain
Oct 22 '08 #1
2 2165
Atli
5,058 Expert 4TB
Noorain.

You have been asked several times before by several moderators to use [code] tags when posting your code examples, yet you continue to ignore us.

Now I am telling you; use [code] tags when posting your code examples or you will find yourself banned from these forums.
I will not ask you again.

Thank you.
Moderator
Oct 22 '08 #2
r035198x
13,262 8TB
Try changing that "\n" to "\r\n" instead.
Oct 22 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Peter A. Schott | last post by:
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of...
10
by: Steve | last post by:
Is there anyone with experience using the Winzip command line add-in? I can't get it to create the zip file with a space in the file name. Using: RetValue = Shell("C:\winzip\wzzip.exe...
9
by: Albretch | last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers. I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver From some reason both drivers Exceptions tell me...
1
by: Fester Bestertester | last post by:
Okay, here's the bonehead question of the day: Is there some syntax or command line switch that I can use to call a Public Sub from a command line? If so, what is the syntax? The purpose: if I...
1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
3
by: andrew | last post by:
Hello, I have spend the past day trying to figure out how to do this. PROBLEM: My instructor wants us to use a shapes library that horstmann wrote. An example would be: /////////////////////////...
3
by: jlw16 | last post by:
Hello, I’m trying to use my vbs script to get a command line argument for a file which will need to be opened through QuickTestPro. Below are the commands I’m using: Dim qt_file 'As String ->...
4
by: comp.lang.php | last post by:
I am trying to simply pipe in 2 very small commands and not have to create a PHP script to do this: However, I do not have the "-r" option in PHP 4.3.9, and I would think that I would, but...
6
by: goodguyjam | last post by:
Hi all, I'm having trouble with mysql. I've just finished my php coding for HTTP authentication and with some help am now getting a login window pop up whenever I click on a link on my website...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.