3 Replies - 4384 Views - Last Post: 11 June 2005 - 11:27 PM Rate Topic: -----

#1 nascent  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-June 05

how do I add punctuation to output?

Posted 11 June 2005 - 04:08 PM

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

Is This A Good Question/Topic? 0
  • +

Replies To: how do I add punctuation to output?

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how do I add punctuation to output?

Posted 11 June 2005 - 05:06 PM

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


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


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

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


Was This Post Helpful? 0
  • +
  • -

#3 nascent  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-June 05

Re: how do I add punctuation to output?

Posted 11 June 2005 - 09:08 PM

Amadeus,

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

nascent
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how do I add punctuation to output?

Posted 11 June 2005 - 11:27 PM

No problem at all...welcome to dreamincode. Please feel free to ask any questions you wish.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1