more invisibility

Discussion in 'PHP' started by gilk, Aug 18, 2007.

  1. #1
    Maybe the problem in the "invisible" query thread is not due to the code?
    The reason I suggest this possibility is that I have reduced the problem to the following 2 sets of code....one which works and one which doesnt work.
    The problem is that I cant see any difference between the 2.
    If I copy "workingcode.php" into my program the program works
    If I copy "non-workingcode.php" into my program the program wont work but doesnt throw any errors either....seems invisible!!!
    workingcode.php
    
    <?php
    session_start();
    // open the connection
    $conn = mysql_connect("h41mysql45.secureserver.net", "ezevetdistanceed", "password");
    // pick the database to use
    mysql_select_db("ezevetdistanceed",$conn);
    // create the SQL statement
    $sql = "SELECT * FROM studentanswers WHERE studentid = '$studentid' and quiznum = $_POST[quiznumber]";
    // execute the SQL statement
    $result = mysql_query($sql, $conn) or die(mysql_error());
    /* Display results in a table */
      echo "<table cellspacing='15'>";
      echo "<tr><td colspan='4'><hr></td></tr>";
      while ($row = mysql_fetch_array($result))
      {
         extract($row);
          echo "<tr>\n
               <td>$quiznum</td>\n
               <td>$datetime </td>\n
               <td>$passfail</td>\n
               <td>$num_wrong</td>\n
               </tr>\n";
         echo "<tr><td colspan='4'><hr></td></tr>\n";
      }
      echo "</table>\n";
    ?>
    
    
    PHP:
    and the non-workingcode.php

    
    <?php
    session_start();
    // open the connection
    $conn = mysql_connect("h41mysql45.secureserver.net", "ezevetdistanceed", "password");
    // pick the database to use
    mysql_select_db("ezevetdistanceed",$conn);
    // create the SQL statement
    $sql = "SELECT * FROM studentanswers WHERE studentid = '$studentid' and quiznum = $_POST[quiznumber]";
    // execute the SQL statement
    $result = mysql_query($sql, $conn) or die(mysql_error());
    /* Display results in a table */
      echo "<table cellspacing='15'>";
      echo "<tr><td colspan='4'><hr></td></tr>";
      while ($row = mysql_fetch_array($result))
      {
         extract($row);
          echo "<tr>\n
               <td>$quiznum</td>\n
               <td>$datetime </td>\n
               <td>$passfail</td>\n
               <td>$num_wrong</td>\n
               </tr>\n";
         echo "<tr><td colspan='4'><hr></td></tr>\n";
      }
      echo "</table>\n";
    ?>
    
    PHP:
    Now as far as I can see the snippets are identical. I hope someone can spot a difference.
    The only difference in the snippets is that the one that works was written from scratch, while the one that doesnt was derived from copy and pasting bits of code from here and there. I suspect that there must be hidden tags or remnants that I cannot see. I am using EditPad Pro as my php editor...could this be a problem???

    I really do appreciate coments and suggestions from the php community. just hope I can get this peculiar issue fixed.
    Thanx

    PS: Have just performed a file comparison on the 2 files above and EditPad Pro says that they are in fact identical......yet when I copy the Nonworking version then PHP just seems to ignore it.....got me scratching the old head!!@#$$@#
     
    gilk, Aug 18, 2007 IP
  2. gilk

    gilk Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If I write a php script in NOTEPAD it works as expected.
    If I open that script in EDITPAD PRO, save it, and FTP it I get all sorts of errors.
    If I then open that offending script in NOTEPAD again and FTP it everything is fine.
    The problem is that both scripts appear the same to the eye, even just a small four line script such as
    
    <?php
    session_start();
    echo time() ;
    ?>
    
    PHP:
    gets corrupted somehow with EDITPAD PRO.

    So I suppose this is a resolution of sorts......anyone have a php editor recommendation that colors syntax that doesnt do this
     
    gilk, Aug 19, 2007 IP