•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,965 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,617 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1644 | Replies: 10
![]() |
•
•
Join Date: Jul 2007
Posts: 111
Reputation:
Rep Power: 2
Solved Threads: 2
hi, im having a bit of trouble learning php. My script is working but it is showing the amount of characters i am echoing out....heres the code.
$tireorder = 'you have ordered: '.$tireqty.' tires.' ;
//open the file and check to see if it exists//
$fp = fopen("file.txt","r+");
if(!$fp) {
echo "Your order could not be prossesed at this time";
exit;
}
//writing to a file//
fwrite($fp, $tireorder);
//closing the file//
fclose($fp);
//reading the file//
$data = @readfile("file.txt");
//echoing out//
echo $data;
?>
It writes to the text file - you have ordered: {tire amount} tires. {character amount}
Is there anyway to get rid of the character count?
all suggestions will help thanx
$tireorder = 'you have ordered: '.$tireqty.' tires.' ;
//open the file and check to see if it exists//
$fp = fopen("file.txt","r+");
if(!$fp) {
echo "Your order could not be prossesed at this time";
exit;
}
//writing to a file//
fwrite($fp, $tireorder);
//closing the file//
fclose($fp);
//reading the file//
$data = @readfile("file.txt");
//echoing out//
echo $data;
?>
It writes to the text file - you have ordered: {tire amount} tires. {character amount}
Is there anyway to get rid of the character count?
all suggestions will help thanx
I dunno, maybe you just need to write to a file:
php Syntax (Toggle Plain Text)
<?php $fp = fopen("file.txt","w") or die ("couldn't open!"); fwrite($fp, "blah\n"); fclose($fp); ?>
... the hat of 'is this a cat in a hat?'
Can you test the following as a separate php script and tell me what you see?
If I am correct it should echo out blah
php Syntax (Toggle Plain Text)
<?php $filename = "file.txt"; $fp = fopen($filename, "r") or die ("nope"); while (!feof($fp)) { $line = fgets($fp, 1024); echo "$line<br>"; } ?>
If I am correct it should echo out blah
Last edited by iamthwee : Nov 18th, 2007 at 1:42 pm.
... the hat of 'is this a cat in a hat?'
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- C++ Reading from a text file (C++)
- Help with a 2D array from a text file (C++)
- read text file (C)
- Reading in a text file string is not complete (Pascal and Delphi)
- how do i read the last line of a text file? (Python)
- reading txt file into array (C++)
Other Threads in the PHP Forum
- Previous Thread: url pass question
- Next Thread: difference of two days



... could you explain ?
Linear Mode