Jump to content

Displaying punctuation


rdub

Recommended Posts

This is human issue.

 

A coma in a number to separate fields in it to make it easier to read is a human convention, not a computer or a database convention.

 

You would need to format your number when you display it. Off of the top of my head, I don't know if mysql has a number_format function (you could look it up in the mysql manual), but php does - http://us2.php.net/number_format

Here it is. Tried the working code without all of the quotes but received error.

The code below shows the results as before I added the change.

[code<?php
$display = 2;
$cols = 0;
echo "<table class=sample width=556 align=left";
while($fetched = mysql_fetch_array($result)){
   if($cols == 0){
       echo "<tr>\n";
   }
   
   
   // put what you would like to display within each cell here
   "<tr>\n";
   echo "<td width=378 valign=top>".$fetched['id']."<br />"."<span class=style1>"."<strong>".$fetched['Customer']."</strong>".
   ("<img src='" . $fetched['thumb'] . "' /> ") .
   "<br />"."<span class=style1e>".$fetched['hi_lite']."</span>".
   "<br />".$fetched['Phone'].
   "<span class=style1d>".$fetched['Description']."</span>".

   "<br />"."<span class=style1d>"."<number_format ($fetched('price'), 2, '.', '')>"."<strong>"."$".$fetched['price']."</strong>"."</span>".

   "<br /><a href='mailto:".$fetched['email'] . "'>". $fetched['email'] . "</a>";
   echo "<br /><a href='".$fetched['web'] . "' target='_blank'>". $fetched['web'] . "</a>";
   	"<br />".
   "</span>"."</td>\n";
?>

 

(edited by kenrbnsn to add


tags)

Here it is. Tried the working code without all of the quotes but received error.

 

The code below shows the results as before I added the change.

 

<?

$display = 2;

$cols = 0;

echo "<table class=sample width=556 align=left";

while($fetched = mysql_fetch_array($result)){

   if($cols == 0){

       echo "<tr>\n";

   }

  

  

   // put what you would like to display within each cell here

   "<tr>\n";

   echo "<td width=378 valign=top>".$fetched['id']."<br />"."<span class=style1>"."<strong>".$fetched['Customer']."</strong>".

   ("<img src='" . $fetched['thumb'] . "' /> ") .

   "<br />"."<span class=style1e>".$fetched['hi_lite']."</span>".

   "<br />".$fetched['Phone'].

   "<span class=style1d>".$fetched['Description']."</span>".

 

   "<br />"."<span class=style1d>"."<number_format ($fetched('price'), 2, '.', '')>"."<strong>"."$".$fetched['price']."</strong>"."</span>".

 

   "<br /><a href='mailto:".$fetched['email'] . "'>". $fetched['email'] . "</a>";

   echo "<br /><a href='".$fetched['web'] . "' target='_blank'>". $fetched['web'] . "</a>";

   "<br />".

   "</span>"."</td>\n";

 

number_format is a function not a HTML tag! Cleaned your code up a bit

<?php
$display = 2;
$cols = 0;

echo "<table class=sample width=556 align=left";
while($fetched = mysql_fetch_array($result))
{
   if($cols == 0){
       echo "<tr>\n";
   }

   // put what you would like to display within each cell here
   "<tr>\n";
   echo "<td width=378 valign=top>".$fetched['id']."<br />".
        "<span class=style1><strong>".$fetched['Customer']. "</strong>(<img src='" . $fetched['thumb'] . "' /> )<br />".
        "<span class=style1e>".$fetched['hi_lite']."</span><br />".$fetched['Phone'].
        "<span class=style1d>".$fetched['Description']."</span><br />".
        "<span class=style1d><strong>$".number_format ($fetched('price'), 2, '.', '')."</strong></span><br />".
        "<a href='mailto:".$fetched['email'] . "'>". $fetched['email'] . "</a><br /><a href='".$fetched['web'] . "' target='_blank'>". $fetched['web'] . "</a>";
   	"<br /></span></td>\n";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.