PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old March 2nd, 2004, 10:05 AM
tox tox is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 tox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
cutting text in PHP

I am not sure if it is possible in PHP at all.

I have a text field. I copy a block of plain text into it. Now I want a (PHP) code that works this text like this:
1. selects all text UNTIL first comma (,) and stores it to database.
2. then, from the first comma till the second comma, selects all text between these, and stores to DB.
3. and so on.

Is it possible in PHP at all, or should I try it in JavaScript or some other language?

I am a beginner in PHP

Reply With Quote
  #2  
Old March 2nd, 2004, 10:38 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Head over to php.net and check out the split() function (which is an alias to explode()). These will allow you to split a string on commas and put the values in an array. Then you can put the different array parts into your database.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old March 2nd, 2004, 10:43 AM
tox tox is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 tox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks, I'll do that. The beginners main problem is, they don't even know what commands to explore

Reply With Quote
  #4  
Old March 2nd, 2004, 11:51 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Yep, I know that conundrum well. When I was first starting out, I wrote all kinds of code to solve problems that there was already a function for. Mosey on over to http://www.php.net/manual/en/ whenever you're in doubt. From there, you can find the reference on string functions, for example, and read a menu of what's at your disposal. It ain't Steinbeck, but if it saves you time and effort in the meantime, it might be worth a few minutes.

Reply With Quote
  #5  
Old March 4th, 2004, 05:35 AM
tox tox is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 tox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yea, soon I have visited this page more then any other, but it still remains as a "searching a nail from the beach (or whatever)" style search
Anyway, to everyone like me (beginners, worse case newbies), keep on looking
Thx

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > cutting text in PHP


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


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





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