简体   繁体   中英

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 discounts" 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM