26 Replies Latest reply on Sep 30, 2008 4:57 PM by brywilson88

    if (!$result) - Help

    brywilson88 Level 1
      I see in the forum there is a lot of discussion regarding search results. I have even asked the question before and got good advice. However, I would to modify my question a bit. Using php, I search my database and return records. Sometimes, there are no results. With no results, I just get white space. What I would like to happen is with no results, the user is directed to another html page. Then, I can create a no results page that could explain either why there are no results or how to improve their search. Seems simple. However, in the books I have and through my research online all I can find is an echo code that just prints a no results message.

      Is there a way to redirect the user to another page if there are no results? And, if so, where would it go in the following code? I have tried inserting the echo code in several places and go (funny enough) no results. (Dreamweaver created this code so I am not that familiar with all of it – especially at the end).

      If you can help, thanks.

      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch ($theType) {
      case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
      case "long":
      case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
      case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
      case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
      case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
      }
      return $theValue;
      }
      }

      $maxRows_rsCC = 4;
      $pageNum_rsCC = 0;
      if (isset($_GET['pageNum_rsCC'])) {
      $pageNum_rsCC = $_GET['pageNum_rsCC'];
      }
      $startRow_rsCC = $pageNum_rsCC * $maxRows_rsCC;

      $aCc_rsCC = "3";
      if (isset($_POST['aCc'])) {
      $aCc_rsCC = (get_magic_quotes_gpc()) ? $_POST['aCc'] : addslashes($_POST['aCc']);
      }
      $aCc2_rsCC = "3";
      if (isset($_POST['aCc'])) {
      $aCc2_rsCC = (get_magic_quotes_gpc()) ? $_POST['aCc'] : addslashes($_POST['aCc']);
      }
      $typeCc_rsCC = "1";
      if (isset($_POST['typeCc'])) {
      $typeCc_rsCC = (get_magic_quotes_gpc()) ? $_POST['typeCc'] : addslashes($_POST['typeCc']);
      }
      $typeCc2_rsCC = "1";
      if (isset($_POST['typeCc'])) {
      $typeCc2_rsCC = (get_magic_quotes_gpc()) ? $_POST['typeCc'] : addslashes($_POST['typeCc']);
      }
      $timeCc_rsCC = "2";
      if (isset($_POST['timeCc'])) {
      $timeCc_rsCC = (get_magic_quotes_gpc()) ? $_POST['timeCc'] : addslashes($_POST['timeCc']);
      }
      $timeCc2_rsCC = "2";
      if (isset($_POST['timeCc'])) {
      $timeCc2_rsCC = (get_magic_quotes_gpc()) ? $_POST['timeCc'] : addslashes($_POST['timeCc']);
      }
      $zCc_rsCC = "20814";
      if (isset($_POST['zCc'])) {
      $zCc_rsCC = (get_magic_quotes_gpc()) ? $_POST['zCc'] : addslashes($_POST['zCc']);
      }
      $zCc2_rsCC = "20814";
      if (isset($_Post['zCc'])) {
      $zCc2_rsCC = (get_magic_quotes_gpc()) ? $_Post['zCc'] : addslashes($_Post['zCc']);
      }
      $cCc_rsCC = "2";
      if (isset($_POST['cCc'])) {
      $cCc_rsCC = (get_magic_quotes_gpc()) ? $_POST['cCc'] : addslashes($_POST['cCc']);
      }
      $cCc2_rsCC = "2";
      if (isset($_POST['cCc'])) {
      $cCc2_rsCC = (get_magic_quotes_gpc()) ? $_POST['cCc'] : addslashes($_POST['cCc']);
      }
      mysql_select_db($database_connMM, $connMM);
      $query_rsCC = sprintf("SELECT ccPro.ID, vs.ID, vs.Name, vs.Dis1, vs.Dis2, vs.Dis3, vs.Dis4, vs.ImageLink, vendors.TextLink FROM ccPro, vs WHERE (ccA >= %s) AND (ccType = %s) AND (ccTime <= %s) AND (ccmin <= %s) AND (ccmax >= %s) AND (ccC <= %s) AND (ccPro.ID = vs.ID) XOR (ccA >= %s) AND (ccType = %s) AND (ccTime <= %s) AND (ccmin = 0) AND (ccC <= %s) AND (ccPro.ID = vs.ID)", GetSQLValueString($aCc_rsCC, "int"),GetSQLValueString($typeCc_rsCC, "int"),GetSQLValueString($timeCc_rsCC, "int"),GetSQLValueString($zCc_rsCC, "int"),GetSQLValueString($zCc2_rsCC, "int"),GetSQLValueString($cCc_rsCC, "int"),GetSQLValueString($aCc2_rsCC, "int"),GetSQLValueString($typeCc2_rsCC, "int"),GetSQLValueString($timeCc2_rsCC, "int"),GetSQLValueString($cCc2_rsCC, "int"));
      $query_limit_rsCC = sprintf("%s LIMIT %d, %d", $query_rsCC, $startRow_rsCC, $maxRows_rsCC);
      $rsCC = mysql_query($query_limit_rsCC, $connMM) or die(mysql_error());
      $row_rsCC = mysql_fetch_assoc($rsCC);

      if (isset($_GET['totalRows_rsCC'])) {
      $totalRows_rsCC = $_GET['totalRows_rsCC'];
      } else {
      $all_rsCC = mysql_query($query_rsCC);
      $totalRows_rsCC = mysql_num_rows($all_rsCC);
      }
      $totalPages_rsCC = ceil($totalRows_rsCC/$maxRows_rsCC)-1;
        • 1. Re: if (!$result) - Help
          Level 7
          brywilson88 wrote:
          > Is there a way to redirect the user to another page if there are no results?

          Yes. Use the PHP header() function:

          http://docs.php.net/manual/en/function.header.php

          > And, if so, where would it go in the following code?

          Just after the following section:

          > if (isset($_GET['totalRows_rsCC'])) {
          > $totalRows_rsCC = $_GET['totalRows_rsCC'];
          > } else {
          > $all_rsCC = mysql_query($query_rsCC);
          > $totalRows_rsCC = mysql_num_rows($all_rsCC);
          > }
          > $totalPages_rsCC = ceil($totalRows_rsCC/$maxRows_rsCC)-1;

          Add the following code immediately after the preceding section:

          if ($totalRows_rsCC < 0) {
          header('Location: http://www.example.com/help.php');
          exit;
          }

          Replace http://www.example.com/help.php with the actual URL for the help
          page.

          --
          David Powers, Adobe Community Expert
          Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
          Author, "PHP Solutions" (friends of ED)
          http://foundationphp.com/
          • 2. Re: if (!$result) - Help
            brywilson88 Level 1
            David Powers - Thank you I will give that a try. I have looked at several online manuals but just did not know what to look for. Would have never thought of a header
            • 3. if (!$result) - Help
              brywilson88 Level 1
              David Powers, I tried what you suggested. It's not working. It does not redirect. I went to the section of the manual your suggested ../function.header.php. and cannot figure out what is wrong. I know my help page is OK as I can find that by typing in its address in my browser. I just can't figure out what is wrong here - this should work. Can you help again?
              • 4. Re: if (!$result) - Help
                Level 7
                brywilson88 wrote:
                > David Powers, I tried what you suggested. It's not working. It does not
                > redirect.

                What happens? Do you get an error message? If so, what does it say? If
                not, do you have display_errors turned off in PHP?

                If display_errors is turned off, add this to the top of the script:

                <?php ini_set('display_errors', '1'); ?>

                --
                David Powers, Adobe Community Expert
                Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
                Author, "PHP Solutions" (friends of ED)
                http://foundationphp.com/
                • 5. Re: if (!$result) - Help
                  brywilson88 Level 1
                  I will give that a try and let you know what happens. Right now, it does not do anything different then before I made the header() change. It just goes to my results page and displays only white space.

                  Thanks,

                  Joe
                  • 6. Re: if (!$result) - Help
                    brywilson88 Level 1
                    David Powers, I tried the <?php ini_set('display_errors', '1'); ?> and I don't get any different results or error messages. For some reason it is not redirecting.

                    Not sure what to tell you. Could be a problem with my Host - Godaddy. I am fighting with them right now regading my php.ini file (a file I never knew I had until last friday). They won't provide any help - all they can say is "we don't help with scripting issues" so they are no help with anything.

                    Thanks for your help. I will try to address the problem in a different manner - if I can think of another way to deal with it.

                    Thanks.
                    • 7. Re: if (!$result) - Help
                      brywilson88 Level 1
                      David Powers:
                      Could you help with my current php.ini file? It is shown below. What am I missing here? I now use version 5.x and have remaned this file php5.ini.

                      register_globals = off
                      allow_url_fopen = on

                      expose_php = Off
                      max_input_time = 60
                      variables_order = "EGPCS"
                      extension_dir = ./
                      upload_tmp_dir = /tmp
                      precision = 12
                      SMTP = relay-hosting.secureserver.net
                      url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

                      [Zend]
                      zend_extension=/usr/local/zo/ZendExtensionManager.so
                      zend_extension=/usr/local/zo/4_3/ZendOptimizer.so

                      • 8. Re: if (!$result) - Help
                        You need to ensure that you have not output any X/HTML before the header(Location: http://www.somesite.org); exit; statements. Redirects done via header must be issued before any content/text is sent. Otherwise a header based redirect will fail.
                        • 9. Re: if (!$result) - Help
                          brywilson88 Level 1
                          Thank you, I don't believe I have any html before the header() as all of my html code text comes after the exit statement (this is what follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">). Prior to the header() statement, all I have is between <?php ...?>. What is between here is my search queries and variables.

                          That's for responding.
                          • 10. Re: if (!$result) - Help
                            Level 7
                            A blank space could be interpreted as output to the browser, e.g.,

                            this -

                            ?> <?php

                            instead of this -

                            ?><?php

                            --
                            Murray --- ICQ 71997575
                            Adobe Community Expert
                            (If you *MUST* email me, don't LAUGH when you do so!)
                            ==================
                            http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                            http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                            ==================


                            "brywilson88" <webforumsuser@macromedia.com> wrote in message
                            news:gbre3u$bul$1@forums.macromedia.com...
                            > Thank you, I don't believe I have any html before the header() as all of
                            > my
                            > html code text comes after the exit statement (this is what follows:
                            > <!DOCTYPE
                            > html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                            > " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">). Prior to the
                            > header() statement, all I have is between <?php ...?>. What is between
                            > here is
                            > my search queries and variables.
                            >
                            > That's for responding.
                            >

                            • 11. Re: if (!$result) - Help
                              brywilson88 Level 1
                              Thank you. I will remove all blank spaces.
                              • 12. Re: if (!$result) - Help
                                brywilson88 Level 1
                                No breaks between the ?><?php to remove. Trying to research more on the header(). Do you know of any good manuals that may describe the header() indepth?

                                Thanks for everyone's help thus far.
                                • 13. Re: if (!$result) - Help
                                  Level 7
                                  Do you have blank lines between PHP code blocks?

                                  ANYTHING output to the browser prior to your PHP Header command will cause
                                  this error to be thrown.

                                  --
                                  Murray --- ICQ 71997575
                                  Adobe Community Expert
                                  (If you *MUST* email me, don't LAUGH when you do so!)
                                  ==================
                                  http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                                  http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                                  ==================


                                  "brywilson88" <webforumsuser@macromedia.com> wrote in message
                                  news:gbrlks$l6k$1@forums.macromedia.com...
                                  > No breaks between the ?><?php to remove. Trying to research more on the
                                  > header(). Do you know of any good manuals that may describe the header()
                                  > indepth?
                                  >
                                  > Thanks for everyone's help thus far.

                                  • 14. Re: if (!$result) - Help
                                    Level 1
                                    Read the comment section for more details:

                                    http://us2.php.net/header
                                    • 15. if (!$result) - Help
                                      brywilson88 Level 1
                                      Not sure what you mean between php blocks. My code start with <?php require_once('../Connections/connMM.php'); ?>
                                      <?php ini_set('display_errors', '1'); ?>
                                      <?php
                                      --- Bunch of php code here ----
                                      Ends the php with ?> as:
                                      if (isset($_GET['totalRows_rsMort'])) {
                                      $totalRows_rsMort = $_GET['totalRows_rsMort'];
                                      } else {
                                      $all_rsMort = mysql_query($query_rsMort);
                                      $totalRows_rsMort = mysql_num_rows($all_rsMort);
                                      }
                                      $totalPages_rsMort = ceil($totalRows_rsMort/$maxRows_rsMort)-1;

                                      if($totalRows_rsMort<0){
                                      header("Location: http://www.businessmoneytoday.com/Results/NoResults.php");
                                      exit;
                                      }
                                      ?>
                                      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                                      <html xmlns=" http://www.w3.org/1999/xhtml">
                                      <head>

                                      ---then a bunch of html code here ---

                                      In the middle of this code I have the following surrounded by html:

                                      <?php do { ?>
                                      <tr>
                                      <td width="157" class="ImageResults"><div align="center"><?php echo $row_rsMort['ImageLink']; ?></a></div></td>
                                      <td width="468" class="ProductDetails">- <strong class="ProductDetailsTitle"><?php echo $row_rsMort['vendName']; ?></strong><br />
                                      - <?php echo $row_rsMort['vendDis1']; ?><br />
                                      - <?php echo $row_rsMort['vendDis2']; ?><br />
                                      - <?php echo $row_rsMort['vendDis3']; ?><br />
                                      - <?php echo $row_rsMort['vendDis4']; ?><br />
                                      - <?php echo $row_rsMort['TextLink']; ?></td>
                                      </tr>
                                      <?php } while ($row_rsMort = mysql_fetch_assoc($rsMort)); ?>

                                      --- then more html

                                      Then ends with:

                                      </body>
                                      </html>
                                      <?php
                                      mysql_free_result($rsMort);
                                      ?>

                                      I will go through the whole code again to see if I can see any breaks or spaces.

                                      Thanks all for the help.


                                      • 16. Re: if (!$result) - Help
                                        Level 7
                                        brywilson88 posted in macromedia.dreamweaver:

                                        > Not sure what you mean between php blocks. My code start with
                                        > <?php require_once('../Connections/connMM.php'); ?>

                                        Any spaces or extra line feeds before/after the php tags in the above
                                        file?

                                        > <?php ini_set('display_errors', '1'); ?>
                                        > <?php
                                        > --- Bunch of php code here ----
                                        > Ends the php with ?> as:

                                        Is there really a space in front of those opening <?php tags or is that
                                        just the Web forum inserting them? If they're in your code, remove
                                        them.

                                        Why have all those closing php tags followed immediately by opening php
                                        tags anyway? Why not:

                                        <?php require_once('../Connections/connMM.php');
                                        ini_set('error_reporting, E_ALL); // (new suggestion)
                                        ini_set('display_errors', '1');
                                        // --- Bunch of php code here ----
                                        // etc...
                                        ?>

                                        Followed by your HTML with the PHP block in it.


                                        --
                                        Mark A. Boyd
                                        Keep-On-Learnin' :)
                                        • 17. Re: if (!$result) - Help
                                          Level 1
                                          The following is filled with whitespace. Specifically, you need to get rid of the newlines between PHP blocks. i.e.

                                          <?php require_once(...) ?><?php
                                          // more PHP code here
                                          ?>

                                          Specifically the closing and opening of PHP blocks must be on the same line.

                                          quote:

                                          Originally posted by: brywilson88
                                          Not sure what you mean between php blocks. My code start with <?php require_once('../Connections/connMM.php'); ?>
                                          <?php ini_set('display_errors', '1'); ?>
                                          <?php
                                          --- Bunch of php code here ----



                                          • 18. Re: if (!$result) - Help
                                            Level 7
                                            > Specifically the closing and opening of PHP blocks must be on the same
                                            > line.

                                            I've never had that cause problems. Can you cite a reference for it?

                                            --
                                            Murray --- ICQ 71997575
                                            Adobe Community Expert
                                            (If you *MUST* email me, don't LAUGH when you do so!)
                                            ==================
                                            http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                                            http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                                            ==================


                                            "Sean DeMerchant" <webforumsuser@macromedia.com> wrote in message
                                            news:gbtk79$agj$1@forums.macromedia.com...
                                            > The following is filled with whitespace. Specifically, you need to get
                                            > rid of
                                            > the newlines between PHP blocks. i.e.
                                            >
                                            > <?php require_once(...) ?><?php
                                            > // more PHP code here
                                            > ?>
                                            >
                                            > Specifically the closing and opening of PHP blocks must be on the same
                                            > line.
                                            >
                                            >
                                            quote:

                                            Originally posted by: brywilson88
                                            > Not sure what you mean between php blocks. My code start with <?php
                                            > require_once('../Connections/connMM.php'); ?>
                                            > <?php ini_set('display_errors', '1'); ?>
                                            > <?php
                                            > --- Bunch of php code here ----
                                            >

                                            >
                                            >
                                            >

                                            • 19. Re: if (!$result) - Help
                                              Level 1
                                              This is not normally a problem, but a newline between PHP blocks is text sent from the server to the browser and once text is sent to the browser header based redirection does not work.

                                              quote:

                                              Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.

                                              - http://us.php.net/header

                                              Hence,




                                              <?php some includes>
                                              <?php
                                              if( $something )
                                              {
                                              header('Location: http://www.somesite.net/something.php');
                                              die;
                                              }
                                              ?>
                                              <!DOCTYPE ...



                                              will not work if $something evaluates to true.

                                              The extraneous whitespace (newlines) must be removed. This yields:




                                              <?php some includes><?php
                                              if( $something )
                                              {
                                              header('Location: http://www.somesite.net/something.php');
                                              die;
                                              }
                                              ?><!DOCTYPE ...





                                              quote:

                                              Originally posted by: Newsgroup User
                                              > Specifically the closing and opening of PHP blocks must be on the same
                                              > line.

                                              I've never had that cause problems. Can you cite a reference for it?

                                              --
                                              Murray --- ICQ 71997575
                                              Adobe Community Expert
                                              • 20. Re: if (!$result) - Help
                                                Level 7
                                                I guess I'm lucky. It's always worked for me without throwing that error.

                                                --
                                                Murray --- ICQ 71997575
                                                Adobe Community Expert
                                                (If you *MUST* email me, don't LAUGH when you do so!)
                                                ==================
                                                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                                                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                                                ==================


                                                "Sean DeMerchant" <webforumsuser@macromedia.com> wrote in message
                                                news:gbttr8$nad$1@forums.macromedia.com...
                                                > This is not normally a problem, but a newline between PHP blocks is text
                                                > sent
                                                > from the server to the browser and once text is sent to the browser header
                                                > based redirection does not work.
                                                >
                                                >
                                                quote:

                                                Remember that header() must be called before any actual output is sent,
                                                > either by normal HTML tags, blank lines in a file, or from PHP.

                                                > - http://us.php.net/header
                                                >
                                                > Hence,
                                                >
                                                >

                                                >
                                                > <?php some includes>
                                                > <?php
                                                > if( $something )
                                                > {
                                                > header('Location: http://www.somesite.net/something.php');
                                                > die;
                                                > }
                                                > ?>
                                                > <!DOCTYPE ...
                                                >

                                                >
                                                > will not work if $something evaluates to true.
                                                >
                                                > The extraneous whitespace (newlines) must be removed. This yields:
                                                >
                                                >

                                                >
                                                > <?php some includes><?php
                                                > if( $something )
                                                > {
                                                > header('Location: http://www.somesite.net/something.php');
                                                > die;
                                                > }
                                                > ?><!DOCTYPE ...
                                                >

                                                >
                                                >
                                                >
                                                >
                                                quote:

                                                Originally posted by: Newsgroup User
                                                > > Specifically the closing and opening of PHP blocks must be on the same
                                                > > line.
                                                >
                                                > I've never had that cause problems. Can you cite a reference for it?
                                                >
                                                > --
                                                > Murray --- ICQ 71997575
                                                > Adobe Community Expert

                                                >

                                                • 21. Re: if (!$result) - Help
                                                  Level 7
                                                  .oO(Murray *ACE*)

                                                  >I guess I'm lucky. It's always worked for me without throwing that error.

                                                  No luck required. Single linebreaks after a closing tag are ignored by
                                                  the PHP interpreter. From the manual:

                                                  | The closing tag for the block will include the immediately trailing
                                                  | newline if one is present.

                                                  So this won't cause the headers to be sent:

                                                  <?php
                                                  ...
                                                  ?>
                                                  <?php
                                                  ...
                                                  ?>

                                                  But this will:

                                                  <?php
                                                  ...
                                                  ?>

                                                  <?php
                                                  ...
                                                  ?>

                                                  Micha
                                                  • 22. Re: if (!$result) - Help
                                                    Level 7
                                                    Thanks, Micha. That's consistent with my experience.

                                                    --
                                                    Murray --- ICQ 71997575
                                                    Adobe Community Expert
                                                    (If you *MUST* email me, don't LAUGH when you do so!)
                                                    ==================
                                                    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                                                    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                                                    ==================


                                                    "Michael Fesser" <netizen@gmx.de> wrote in message
                                                    news:8555e4lf08s874ont23t607td2opktora2@4ax.com...
                                                    > .oO(Murray *ACE*)
                                                    >
                                                    >>I guess I'm lucky. It's always worked for me without throwing that error.
                                                    >
                                                    > No luck required. Single linebreaks after a closing tag are ignored by
                                                    > the PHP interpreter. From the manual:
                                                    >
                                                    > | The closing tag for the block will include the immediately trailing
                                                    > | newline if one is present.
                                                    >
                                                    > So this won't cause the headers to be sent:
                                                    >
                                                    > <?php
                                                    > ...
                                                    > ?>
                                                    > <?php
                                                    > ...
                                                    > ?>
                                                    >
                                                    > But this will:
                                                    >
                                                    > <?php
                                                    > ...
                                                    > ?>
                                                    >
                                                    > <?php
                                                    > ...
                                                    > ?>
                                                    >
                                                    > Micha

                                                    • 23. Re: if (!$result) - Help
                                                      Level 1
                                                      My bad. <smile> Nonetheless, from a practical standpoint both
                                                      ?>
                                                      <?php

                                                      and

                                                      ?>
                                                      <?php

                                                      look the same even though the first is "?>\n<?php" and the second is "?> \n<?php".

                                                      thanks for the info,

                                                      Sean

                                                      quote:

                                                      Originally posted by: Newsgroup User
                                                      .oO(Murray *ACE*)

                                                      >I guess I'm lucky. It's always worked for me without throwing that error.

                                                      No luck required. Single linebreaks after a closing tag are ignored by
                                                      the PHP interpreter. From the manual:

                                                      | The closing tag for the block will include the immediately trailing
                                                      | newline if one is present.



                                                      • 24. Re: if (!$result) - Help
                                                        brywilson88 Level 1
                                                        The > in front on the php opening tags must be how this forum outputs responses. I did not put them there.

                                                        The reason the code is the way it is with all the opening and closing tags is how Dreamweaver builds it. I though of removing some of them but it kind of keeps it organizaed for me.

                                                        Thanks for responding.
                                                        • 25. Re: if (!$result) - Help
                                                          brywilson88 Level 1
                                                          Thank you, I will give that a try. I did make sure that there were not real spaces between the code i.e. like <?php ?>. I see now this was want Murray *ACE* was trying to show. Thanks to all of you. I will give this a try.

                                                          Would it even be better to put all the php code on one line without any space including newlines. May look a little funny and be hard to follow but may work?

                                                          Thanks.
                                                          • 26. if (!$result) - Help
                                                            brywilson88 Level 1
                                                            Tried to take out all newlines and anything I saw as a space and it still does not work. I have checked several manuals and they all say the same, no spaces. But, as far as I can tell I don't have any spaces so i don't know what is going on. I even tried to have only one opening php tag and one closing php tag. Still no results. I think I will try to rebuild my pages to see if I have something in there I shouldn't.

                                                            Thanks all.