I need some help with formatting some text received from a database
query. I am only selecting a single row per query so the formatting
will only be performed on a single row. The rows I need to format
upon display to the user are currently in text like so: word1 word2
word3 word4 (note there are only spaces between each word)
I just want to insert a character between each word when displayed. A
dash, for example. I want it to look like this: word1 - word2 - word3
- word4 etc. Its too late to do it b4 I put it in the database, so I
have to do it now. Any ideas?
TIA
Rob 2 4367
On 7-Oct-2003, go****@si.rr.co m (Robert) wrote: I need some help with formatting some text received from a database query. I am only selecting a single row per query so the formatting will only be performed on a single row. The rows I need to format upon display to the user are currently in text like so: word1 word2 word3 word4 (note there are only spaces between each word)
I just want to insert a character between each word when displayed. A dash, for example. I want it to look like this: word1 - word2 - word3 - word4 etc. Its too late to do it b4 I put it in the database, so I have to do it now. Any ideas?
I'm not totally clear on the question but try this:
// assuming $row has been retrieved from the database
$fieldwithdashe s = str_replace(' ',' - ',$row['fieldname']);
echo $fieldwithdashe s;
--
Tom Thackrey www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
"Tom Thackrey" <us***********@ nospam.com> schrieb: // assuming $row has been retrieved from the database $fieldwithdashe s = str_replace(' ',' - ',$row['fieldname']);
I just wanted to post something with regular expressions. Glad you were
first. :-)
Regards,
Matthias This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: James |
last post by:
HI,
I'm looking for a script that will allow users/admins to have a one
click backup solution for a MYSQL Database..
'BACK DATABASE' button, click and its done...
The a restore option, that shows all current backups, and restores the
selected one with one click...
|
by: AF |
last post by:
I am a real novice to php and MySQL, with about a week's worth of
reading and self tutoring. I have an urgent need to publish a
database of information and need some guidance on how to do this.
This question might be more suited to a MySQL newsgroup, but since php
and MySQL seem to have become almost married to one another, and since
getting the data out and displaying it is where my problem seems to
lie, I thought I would start with...
|
by: Tim |
last post by:
Hi Guys
I have a mysql database that contains guitar tabs and song lyrics (kind of
like my own personal taborama.com),anyway i have everything stored in the
database and use php to display all the records on a web page but my problem
is i can't keep any of the formatting for the tabs or lyrics, i enter
everything into the database via mysqlcc. When i enter the tabs in mysqlcc
it all looks nice and formatted but when i print it in php it...
|
by: Dave Posh |
last post by:
I seem to be having a problem displaying time stored in mysql. The
format stored in the database is 13:15:05. The database data type is
time. I'm using asp vbscript and sql to retrieve the time store in
the database. However asp recognizes the data type as date and
displays the date instead of the time. If I change the data type in
mysql to varchar then asp will display the time correctly, but I
cannot do it this way. I want to be able...
|
by: MLH |
last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application
for me. When he was done, he sent me the PHP files and the MySQL
dump file. Now, when I connect to the application on my LAN using
http://192.168.1.106/~mlh/credifree/index.php the AMP app still
thinks the data resides somewhere else. It runs fine - as long as I
leave my LAN's external internet connection up. But if I unplug my
LAN from the world, my app locks up.
Before I...
| |
by: PMB |
last post by:
Thank you in advance for any and all assistance.
I'm trying to input data from strings to a memo field. I would like to know
how to check first to see if there is text there currently and if so move to
the end and input the new text.
Also, would like to know if I can change the justification on each line of
text as it's entered. i.e.
Company Name, address, city state and zip would be centered and all the
|
by: donpro |
last post by:
Hi,
I have a varchar field in a MySQL database that contains a line of text
like so:
"This is a line if text"
The double quotes are included in the database field.
I cannot seem to display it on my HTML page, it always shows as blank.
|
by: George Lft |
last post by:
ok, first of all, i built my register page using dreamweaver tool which the codes haven been out of control. Now i'm thinking that turning over everything - by using this another set of codes. And these new sets of codes have overwhelmed me a bit. Here's the new code:
CREATE TABLE `users` (
`ID` int(11) NOT NULL auto_increment,
`Username` varchar(255) NOT NULL,
`Password` varchar(255) NOT NULL,
`Temp_pass` varchar(55)...
|
by: gubbachchi |
last post by:
Hi,
For my project I have a "add" button, upon clicking it, it will take the user to next page where there will be a text box and list of data displayed below it which is fetched from mysql database. I have written the code for this which is working fine. But I have a problem, i.e. when user enters the code in text box and clicks "go" button a group of data will be fetched from the database and should be displayed below the text box, where...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |