Page 1 of 1

need help with php code

Posted: Tue May 20, 2003 3:59 am
by jojo
Hi;
I have a database driven webpage, that populate some data(links) from database, and it works fine,
the links appear as a title ( home page, driver page) and they are clickable links,
some of the fields of links in db are empty , and when the page loads the title appear as link ,
I want to have a php code that when the field ( "home_page_url" and "driver_page_url" )are empty of data, the title does not show
as clickable link, only title not clickable.


"home_page_title" is the field for title of the Home page and
"driver_page_title" is for title of driver page .
and "home_page_url" and "driver_page_url" are the fields for links.

If you know how I can make a php code for this I appreciate your
help.

I use Dreamweaver mx, php/mysql
here is the table that show the codes.

Code: Select all

<table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <?php
  while (!$rs_backup->EOF) &#123;
?>
          <tr>
              <td height="25" colspan="2" valign="top"><?php echo $rs_backup->Fields('company_name'); ?></td>
              <td width="232" valign="top"><a href=" <?php echo $rs_backup->Fields('home_page_url'); ?>"><?php echo $rs_backup->Fields('home_page_title'); ?></a></td>
              <td colspan="2" valign="top"><a href=" <?php echo $rs_backup->Fields('driver_page_url'); ?>"><?php echo $rs_backup->Fields('driver_page_title'); ?></a></td>
          </tr>
          <?php
    $rs_backup->MoveNext();
  &#125;
?>
          <tr>
            <td width="173" height="39"> </td>
            <td colspan="3" valign="top"> 
              <table border="0" width="50%" align="center">
                <tr>
                  <td width="23%" align="center"><?php if ($pageNum_rs_backup > 0) &#123; // Show if not first page ?>
                    <a href="<?php printf("%s?pageNum_rs_backup=%d%s", $HTTP_SERVER_VARS&#1111;"PHP_SELF"], 0, $queryString_rs_backup); ?>"><img src="First.gif" border=0></a>
                    <?php &#125; // Show if not first page ?>
                  </td>
                  <td width="31%" align="center"><?php if ($pageNum_rs_backup > 0) &#123; // Show if not first page ?>
                    <a href="<?php printf("%s?pageNum_rs_backup=%d%s", $HTTP_SERVER_VARS&#1111;"PHP_SELF"], max(0, $pageNum_rs_backup - 1), $queryString_rs_backup); ?>"><img src="Previous.gif" border=0></a>
                    <?php &#125; // Show if not first page ?>
                  </td>
                  <td width="23%" align="center"><?php if ($pageNum_rs_backup < $totalPages_rs_backup) &#123; // Show if not last page ?>
                    <a href="<?php printf("%s?pageNum_rs_backup=%d%s", $HTTP_SERVER_VARS&#1111;"PHP_SELF"], min($totalPages_rs_backup, $pageNum_rs_backup + 1), $queryString_rs_backup); ?>"><img src="Next.gif" border=0></a>
                    <?php &#125; // Show if not last page ?>
                  </td>
                  <td width="23%" align="center"><?php if ($pageNum_rs_backup < $totalPages_rs_backup) &#123; // Show if not last page ?>
                    <a href="<?php printf("%s?pageNum_rs_backup=%d%s", $HTTP_SERVER_VARS&#1111;"PHP_SELF"], $totalPages_rs_backup, $queryString_rs_backup); ?>"><img src="Last.gif" border=0></a>
                    <?php &#125; // Show if not last page ?>
                  </td>
                </tr>
              </table></td>
            <td width="190"> </td>
          </tr>
          <tr>
            <td height="2"></td>
            <td width="122"></td>
            <td></td>
            <td width="43"></td>
            <td></td>
          </tr>
            </table>








your is appreciated ,
Thanks

Posted: Tue May 20, 2003 4:05 am
by ckuipers
The easiest thing is to check for the URL, see if it's empty or not. If it's empty, don't write the code.

Posted: Tue May 20, 2003 7:14 am
by tr3s
yah! refer to the manual.

use the

Code: Select all

isset
function to check...