formatting mysql_num_rows($sql)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alcodesign
Forum Newbie
Posts: 3
Joined: Thu Aug 28, 2003 6:55 am

formatting mysql_num_rows($sql)

Post by alcodesign »

i am trying to return the number of rows found in a search using mysql_num_rows($sql) and it works just fine; however, I am trying to format the text such as making is bold using <b> </b> but i cannot seem to be able to do it. any advice is greatly appreciated.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Code: Select all

$rows = mysql_num_rows($sql);

print "<strong>$rows</strong>";
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

or

Code: Select all

echo '<b>'.mysql_num_rows($sql).'</b>';
alcodesign
Forum Newbie
Posts: 3
Joined: Thu Aug 28, 2003 6:55 am

Post by alcodesign »

thank you for the help. i was able to get it to work. my only other question is how to format a price column my code is as follows

Code: Select all

echo "<tr><td>{$results['Part']}</td><td>$ + {$results['Price']}.00</td></tr>";


the price is displayed 10.00 at the moment with no dollar sign. if i use one it thinks the whole thing is a string. what can i do?
User avatar
Crashin
Forum Contributor
Posts: 223
Joined: Mon May 06, 2002 3:42 pm
Location: Colorado

Post by Crashin »

alcodesign wrote:

Code: Select all

echo "<tr><td>{$results['Part']}</td><td>$ + {$results['Price']}.00</td></tr>";
Try:

Code: Select all

echo "<tr><td>" . $results['Part'] . "</td><td>$" . $results['Price'] . ".00</td></tr>";
Post Reply