开发者

Why won't this dynamically-generated <div> display?

Okay, so on my website I have a slider thingy, where it um "slides" between things, and on the homepage, when the page loads it checks the database to see if Column discounts has a value of 1 (or greater than 0, to be precise), which means that if($discounts>0){//do something;} so, if the value inside the discount column is greater than 0, it will (SHOULD) display a dynamically created DIV saying something like "Yay we have discou开发者_如何学Cnts" etc.

But, it won't display! It only displays 2 slides. But the value in the DB is set to 1, so it should be displaying the 3rd slide!

Inside the Head:

if($ddiscount >0)
{           
    $outputsy = '<div class="ambitios_slide">

                     <div class="clear"> 

                         <h1 class="ambitios_fleft">'.$dimage.'</h1>

                         <div class="ambitios_sleder_title">'.$dtitle.'</div>

                         <p>'.$ddescription.'</p>

                     </div>

                  </div>';
 }
 else
 {
     $outputsy = null;
 }

Inside the body:

<?php if($outputsy != null) {echo $outputsy;} ?>

There are no warnings, no errors. The webpage loads fine. It just never displays the dynamically generated DIV! Can someone please help me figure out what is wrong here?

Any help is appreciated

Thank you


in the else part, try setting $outputsy to some random string and see if that gets outputted.

Also try doing a var_dump($ddiscount); and seeing what the actual value of $ddiscount is. If it's something other than what is expected, the problem may be something before this code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜