Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old January 16th, 2003, 07:42 PM
spoonernyc spoonernyc is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: BROOKLYN, NY
Posts: 23 spoonernyc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
News tutorial question

I am trying to make a publishing system that uses both MySQL for finite data and a txt file for longer bit fo info (descriptions etc.) I have found a good way of hacking the two examples in the tutorial section together BUT:

the news tutorial writes everything to a single text file news.txt thjat is delimited by | but how can you get it so that each entry is a seperate .txt file? For example if I have a bunch of data going to the MySQL server with an $id number could I name the text file &id.txt? How would i go about doing this?

thanks for any help

jon spooner

PS this is BY FAR the best PHP tutorial site online
thanks

Reply With Quote
  #2  
Old January 16th, 2003, 09:03 PM
superalloy superalloy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Washington DC
Posts: 58 superalloy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: News tutorial question

After you fill out the database portion, use mysql_insert_id() to get the id for the row you just created (you have to use an autoincrement primary key), then create the file using the value returned from mysql_insert_id() in the filename.

or something along those lines

Reply With Quote
  #3  
Old January 17th, 2003, 04:10 PM
spoonernyc spoonernyc is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: BROOKLYN, NY
Posts: 23 spoonernyc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: News tutorial question

well I dont undertsand...

if I have a line
that normally writes a file called text.txt
fopen(echo 'text.txt','a');

how do I then get it to write

fopen(echo mysql_insert_id() '.txt','a');

????


thanks for the help?


Reply With Quote
  #4  
Old January 17th, 2003, 05:26 PM
hermawan's Avatar
hermawan hermawan is offline
Superman is not dead
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Jakarta, Indonesia
Posts: 531 hermawan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 45 m 29 sec
Reputation Power: 2
Send a message via ICQ to hermawan Send a message via AIM to hermawan Send a message via Yahoo to hermawan Send a message via Google Talk to hermawan Send a message via Skype to hermawan
RE: News tutorial question

Before
php Code:
Original - php Code
  1.  
  2. $filename = "text.txt";
  3. fopen($filename,"a");

Now
php Code:
Original - php Code
  1.  
  2. $filename = mysql_insert_id().".txt";
  3. fopen($filename,"a");

Reply With Quote
  #5  
Old January 19th, 2003, 04:32 PM
spoonernyc spoonernyc is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: BROOKLYN, NY
Posts: 23 spoonernyc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: News tutorial question

Thanks for the help Hermawan.

Got that figured outnow I need help figuring out how to keep the system from "double" submitting. Basically the news tutorial leaves you with a system that adds headlines to the system but doesn't update the admin page to reflect the added headline. And if you hit reload it submits that information again.

Also I will be submitting news with minor html formatting <BR> and <B> </b> tags. And when I do that and try to display that info with <PRE> or <CODE> tags it does not show the actaully html tags.. is there any creative way to do this?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > News tutorial question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway