Link to home
Start Free TrialLog in
Avatar of raw888
raw888

asked on

Hide/ show a recordset row item

Making a page to display a resume. If a category or row is empty or null ..do not want the the title  to appear. using dreamweaver's detail generated recordset. This is one example: nothing displays , regardles if there is data or not. What is wrong? or a suggestion of a better way.

Thanks


     
 <!--travel-->
      <?php if ($totalRows_DetailRS1['travel'] > 0) {  ?>
  <div class="sub_ttl1">Travel?</div>
  <p><?php echo $row_DetailRS1['travel']; ?></p> 
<?php } ?>

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

You can use PHP var_dump() to find out what is in the variables.  For example, you might add this to the script:

var_dump($totalRows_DetailRS1);
var_dump($row_DetailRS1);

Once you can see the data, you will be able to know what path in the code will be dictated by the if() statements.

Be certain to add error_reporting(E_ALL)  to the top of all your scripts in order to avoid accidentally relying on an undefined variable.

If you're relatively new to PHP, you might find some value in using the learning resources shown in this article. DreamWeaver is not a good way to learn PHP, but there are some very good ways shown in the article.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html
Avatar of raw888
raw888

ASKER

will try...
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of raw888

ASKER

<?php error_reporting(E_ALL) ?>
<?php var_dump($totalRows_DetailRS1);?>
<?php var_dump($row_DetailRS1);?>

Open in new window


error message:
Notice: Undefined variable: totalRows_DetailRS1 in /home/resumeva/public_html/sCRIPTS/lIST/Resume_Detail.php on line 2
NULL
Notice: Undefined variable: row_DetailRS1 in /home/resumeva/public_html/sCRIPTS/lIST/Resume_Detail.php on line 3
Avatar of raw888

ASKER

that was the trick...thanks!
Notice: Undefined variable
As soon as you understand what that means, you will be able to move to the next level!  Until then, well, not so much.

Best of luck and thanks for using EE, ~Ray