Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 04-13-2004, 06:08 AM   #1
Member (7 bit)
 
rcx21000's Avatar
 
Join Date: Feb 2004
Posts: 102
Replacing chars in PHP

I have a textfile thats made like this:

thing description
thing description
thing description
...

I can read it, and seperate "thing" and "description", if they are both one word, but they need to be lots of words. The only way that I can think to fix it would be replace all the " " with "|", except the ones that seperate "thing" and "description". Is there a way in PHP to replace all "|" with " " after I've seperated "thing" and "description? If you don't get me, then what I need is a function that will work something like "replace" in VB:

Replace("This|is|a|string|thing.", "|", " ") will give "This is a string thing"

I've googled it, and can't find the answer, either
rcx21000 is offline   Reply With Quote
Old 04-13-2004, 06:17 AM   #2
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Yes, there is a similar function in PHP, str_replace.

However,if you can explain more what you are trying to do, I think there is a better way to do it.
aym is offline   Reply With Quote
Old 04-13-2004, 07:54 AM   #3
Member (7 bit)
 
rcx21000's Avatar
 
Join Date: Feb 2004
Posts: 102
I want to make a site with GP32 (a korean handheld game thingy) downloads. "Thing" would be the path (like games\gloop.fxe) and "Description" would be a description of the download.

Databases seem to complicated for me
rcx21000 is offline   Reply With Quote
Old 04-13-2004, 03:48 PM   #4
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
I'm afraid you'll run into much more trouble trying to store data in flat files, you'll need to write your own read/write functions, handle concurrency, and flat files become slow when they have a lot of data.

Make your life easier and use a database, I suggest you start learning them, and if you find something difficult to understand, you can always ask here

EDIT:

MySQL tutorials:
http://www.onlamp.com/pub/a/php/2003...undations.html
http://www.onlamp.com/pub/a/php/2004...undations.html
http://www.onlamp.com/pub/a/php/2004...undations.html

Using MySQL with PHP tutorial:
http://www.onlamp.com/pub/a/php/2004...undations.html

Last edited by aym; 04-13-2004 at 03:58 PM.
aym is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


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

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



All times are GMT -5. The time now is 12:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2