Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2006, 02:05 PM
Friend of Wrox
 
Join Date: Mar 2005
Location: , , .
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem writing dynamic value into text file in ph

Hi all. i have a little problem writing dynamic value to a ram.txt file. I want write the following infor int a text file:
Code:
<player showDisplay="yes" showPlaylist="yes" autoStart="yes">
  <song path="http://localhost/flash_mp3_player/mp3/08 - Track 8.mp3" title="tajik" /> 
  <song path="http://localhost/flash_mp3_player/mp3/13 - Gar Aya.mp3" title="gar aya" /> 
  </player>
The song path for each song id i pass.
<player showDisplay="yes" showPlaylist="yes" autoStart="yes">
and
</player>
are written once at the start and end of the text file.The title is just the name of song without .mp3 extention.

Currently when i call the code like this:

http://localhost/player/ram4.php?sid=1,2,

the only information which is get written to text file is the url but i want write song path and title in above mention format.

I be happy if an expert help me here.Thanks

ram4.php code
Code:
<?php


$url[1] = "http://localhost/flash_mp3_player/mp3/08 - Track 8.mp3";
$url[2] = "http://localhost/flash_mp3_player/mp3/13 - Gar Aya.mp3";
$url[3] = "http://localhost/flash_mp3_player/mp3/Soroush - Yeh Donya - 02 Shoghe Nafas.mp3";

$mycontent = "";
if (isset($_GET["sid"]))
{
   $allsid = explode (",",$_GET["sid"]);
   $mycontent = array();
   foreach ($allsid AS $value)
      $mycontent[] = $url[$value];
}

echo $mycontent;

$handle = fopen ("ram.txt","w+");
if ($handle)
{
  if (fwrite ( $handle,implode("\r\n",$mycontent)."\r\n") )
  {
      echo "FILE IS WRITTEN SUCCESSFULLY";
  } else
  {
       echo "ERROR IN WRITING TO FILE";
  }
  fclose ($handle);
} else
{
      echo "ERROR IN OPENING FILE";
}
require 'config.txt';
?>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem writing in text box in ASP naureen tahir Dreamweaver (all versions) 0 May 22nd, 2007 09:45 AM
Writing to Text File striker9 ASP.NET 2.0 Basics 1 May 12th, 2006 05:17 AM
writing text file but in an order specifed... stone XSLT 2 October 27th, 2005 05:17 AM
Reading from a text file and writing to a Binary 1 scott01 C++ Programming 0 July 28th, 2003 03:59 AM



All times are GMT -4. The time now is 03:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.