Jump to content

[SOLVED] results from DB not correct


dennismonsewicz

Recommended Posts

Code:

 

foreach($deduct_rows as $rows) {
					echo '<div style="padding-top:20px;">';
						echo '<span class="maintitle" style="font-size: 30px !important; display: block;">Your deductible is $'. $rows->deductible .'</span>';
						echo '<span class="maintitle" style="font-size: 20px; !important; display: block; padding-top: 20px;">Your bundle price is $' . $rows->bundle . '</span';
						echo '<span class="maintitle" style="font-size: 20px; !important; display: block; padding-top: 10px;">Your insurance price is $' . $rows->insurance . '</span';
						echo '<span class="maintitle" style="font-size: 20px; !important; display: block; padding-top: 10px;">Your warranty price is $' . $rows->warranty . '</span';
					echo '</div>';
				}

 

The results come back as the following: $.99 when in the DB the actual row is 5.99

 

So its cutting off the first character.... any ideas?

Link to comment
https://forums.phpfreaks.com/topic/164110-solved-results-from-db-not-correct/
Share on other sites

yeah I noticed that and that didn't fix the problem

 

updated code:

 

foreach($deduct_rows as $rows) {
					echo '<div style="padding-top:20px;">';
						echo '<span class="maintitle" style="font-size: 30px !important;">Your deductible is $' . $rows->deductible . '</span>';
echo $rows->deductible;
					echo '</div>';
				}

 

If I echo out the deductible and it is not inside the span tag then everything displays like it should

<div class="maintitle" style="font-size: 30px ! important;">Your Deductible is .00</div>

 

I have it boiled down to if I include an HTML $ symbol then it doesn't display the characters before the decimal for some reason

I got it fixed. I had to escape the $ symbol

 

updated code:

 

foreach($deduct_rows as $rows) {
					$deduct = $rows->deductible;
					echo '<div style="padding-top:20px;">';
						echo '<span class="maintitle" style="font-size: 30px !important; display: block;">Your deductible is \$'. $rows->deductible .'</span>';
						echo '<span class="maintitle" style="font-size: 20px; !important; display: block; padding-top: 20px;">Your bundle price is \$' . $rows->bundle . '</span>';
						echo '<span class="maintitle" style="font-size: 20px; !important; display: block; padding-top: 10px;">Your insurance price is \$' . $rows->insurance . '</span>';
						echo '<span class="maintitle" style="font-size: 20px; !important; display: block; padding-top: 10px;">Your warranty price is \$' . $rows->warranty . '</span>';
					echo '</div>';
				}

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.