Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
splitting mysql data into variables
Old 02-02-2008, 06:31 PM splitting mysql data into variables
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
I have my content in a field called content. but for a description i want to get the data then split it into different parts i.e.
content: part1 part2 part3
description: part1 part3

Do you know what i mean?.
andyp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-02-2008, 07:30 PM Re: splitting mysql data into variables
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
and are there any delimiters between the parts?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-02-2008, 07:41 PM Re: splitting mysql data into variables
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
A simple way would be to serialize your variables in the db field, if you only want to store them.

Otherwise, as Chris implied, you must have separators in your datas, to delimit each values.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-02-2008, 09:49 PM Re: splitting mysql data into variables
Extreme Talker

Posts: 182
Trades: 0
Serializing is probably best if you must store the data in the same field:
http://php.net/serialize

If the data is separated by spaces ( or any other delimiter ), explode() should work:

http://php.net/explode
bhgchris is offline
Reply With Quote
View Public Profile
 
Old 02-03-2008, 06:25 AM Re: splitting mysql data into variables
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Sounds like your talking about paging a large article into paragraphs. Good feature here making use of PEARs pager class. http://www.alberton.info/pear_pager_...agination.html

If you didn't want to use the two table method outlined above you could just split your content and description fields into arrays. Explode or str_split(php5) spring to mind http://uk.php.net/manual/en/function.str-split.php .

Once your content is in the form of an array you could use PEAR::Pager to paginate the array into manageable paragraphs. You will need to install the PEAR framework.
maxxximus is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to splitting mysql data into variables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17821 seconds with 12 queries