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:
  #1  
Old January 16th, 2003, 08: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, 10: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: 3
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, 05: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, 06: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: 553 hermawan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 44 m 37 sec
Reputation Power: 3
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, 05: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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek