Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,630 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,060 people online right now. Registration is fast and FREE... Join Now!




how do I add punctuation to output?

 
Reply to this topicStart new topic

how do I add punctuation to output?

nascent
post 11 Jun, 2005 - 03:08 PM
Post #1


New D.I.C Head

*
Joined: 11 Jun, 2005
Posts: 9

I am one step *before* clueless newbie, so I hope you'll bear with me <smile>.

In the output, I need to be able to add punctuation after the information in the Duration field if it contains an entry. I cannot figure out how to do that.

I need the output to read like this:

"blah blah blah A great addition to the repertoire. 7 minutes. Ref: 114a9"

but it appears like this:
"blah blah blah A great addition to the repertoire. 7 minutes Ref: 114a9"

This is the code I have thus far:

<?php
include("connectData.inc");
$type="{$_GET['subType']}";
$query = "SELECT * FROM blItem WHERE blSubType='$type'";
echo "<table cellspacing='0' border='0' cellpadding='0'
width='100%'>";
$result = mysql_query($query) or die ("Error: $query");
while ($row = mysql_fetch_array($result)) {
extract($row);
echo "<tr>\n";
echo "<td>{$Title} {$Composer} {$bpSolo} {$Desc} {$Duration} Ref: {$Id}</td>\n";
echo "<td>{$grade}</td>\n";
echo "<td>{$price}</td>\n";
} // end while
echo "</table>\n";
$var = NULL;
?>

Any help gratefully accepted. <smiles>

nascent
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 11 Jun, 2005 - 04:06 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,176



Thanked 33 times

Dream Kudos: 25
My Contributions


Change
CODE

echo "<td>{$Title} {$Composer} {$bpSolo} {$Desc} {$Duration} Ref: {$Id}</td>\n";

to
CODE

echo "<td>{$Title} {$Composer} {$bpSolo} {$Desc} {$Duration}. Ref: {$Id}</td>\n";

or, to make it conditional on the contents of the duration field

CODE

echo "<td>{$Title} {$Composer} {$bpSolo} {$Desc} {$Duration}\n";
if($Duration!="")
  echo ".";
echo "Ref: {$Id}</td>\n";
User is offlineProfile CardPM

Go to the top of the page

nascent
post 11 Jun, 2005 - 08:08 PM
Post #3


New D.I.C Head

*
Joined: 11 Jun, 2005
Posts: 9

Amadeus,

My sincere thanks to you. It was exactly what I needed. <smiles>

nascent
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 11 Jun, 2005 - 10:27 PM
Post #4


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,176



Thanked 33 times

Dream Kudos: 25
My Contributions


No problem at all...welcome to dreamincode. Please feel free to ask any questions you wish.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 03:55AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month