Here is the code since it doesn't look like attachments work here...
 
 
<?php
include ("header.php");
include ("config.php");
 
if ($search) {
 
 
 
  // process form
 
 
 

if ($sort == ""){
 $sort = "lname";
}
 
do { 
 
 if ($fname == '' && $lname == '' && $dept_pulldown == '') {
   echo "<H2><center>You must enter a last name, first name or select a
department<br><br>
    <a href=\"/\">Home</a></center></H2>";
   include ("footer.php");
   exit;
   
 } //end if
  
  if ($fname != '' && $lname == '' && $dept_pulldown != '' && $dept_pulldown
!= 'all') {  // First name only query
 
    $sql = "Select * from emp_numbers where fname = '$fname' && dept =
'$dept_pulldown' order by $sort";  // with dept
    break;
    } elseif ($fname != '' && $lname == '' && $dept_pulldown == '') {
     $sql = "Select * from emp_numbers where fname = '$fname' order by
$sort";  // without dept     break;
     } elseif ($fname != '' && $lname == '' && $dept_pulldown == 'all') {
      $sql = "Select * from emp_numbers where fname = '$fname' order by
$sort";  // with all depts
      break;
  } // end if
 
   if ($fname == '' && $lname != '' && $dept_pulldown != '' &&
$dept_pulldown != 'all') {  // Last name only query
 
    $sql = "Select * from emp_numbers where lname = '$lname' && dept =
'$dept_pulldown' order by $sort";  // with dept
    break;
    } elseif ($fname == '' && $lname != '' && $dept_pulldown == '') {
     $sql = "Select * from emp_numbers where lname = '$lname' order by
$sort";  // without dept
     break;
     } elseif ($fname == '' && $lname != '' && $dept_pulldown == 'all') {
      $sql = "Select * from emp_numbers where lname = '$lname' order by
$sort";  // with all depts
      break;
   } // end if
 
    if ($fname != '' && $lname != '' && $dept_pulldown != '' &&
$dept_pulldown != 'all') {  // Both names query
     $sql = "Select * from emp_numbers where fname = '$fname' && lname =
'$lname' && dept = '$dept_pulldown' order by $sort";  // with dept
     break;
     } elseif ($fname != '' && $lname != '' && $dept_pulldown == '') {
      $sql = "Select * from emp_numbers where fname = '$fname' && lname =
'$lname' order by $sort";  // without dept
      break;
      } elseif ($fname != '' && $lname != '' && $dept_pulldown == 'all') {
       $sql = "Select * from emp_numbers where fname = '$fname' && lname =
'$lname' order by $sort";  // with all depts
       break;
    } // end if
   
     if ($fname == '' && $lname == '' && $dept_pulldown != '' &&
$dept_pulldown != 'all') {  // Deptartment only query
      $sql = "Select * from emp_numbers where dept = '$dept_pulldown' order
by $sort";
      break;
     } // end if
  
      if ($fname == '' && $lname == '' && $dept_pulldown == 'all') {
       $sql = "Select * from emp_numbers order by $sort";  // Query everyone
       break;
      } //end if
 

} while(0);
 
 
 
 // Query results
 
 $db = mysql_connect($dbhost, $dbuname, $dbpass) or die("Can't connect to
server.");
 mysql_select_db("$dbname", $db) or die("Can't select database.");
 
 $result = mysql_query($sql) or die("Bad SQL Statement!<br><br>$sql");
 $nrows  = mysql_num_rows($result);
 
 if ($nrows == 0) {
  echo "<center><font size=+2>Sorry, no records found.<br><br><a
href=\"/\">Home</a></font></center>";
 } else{
 
 
 
 // Display results
 
 echo "<table width=100% border=0 cellspacing=1 cellpadding=3><tr>
  <td width=50%>Total Found: $nrows</td>
  <td width=50% align=\"right\"><a href=\"/\">Home</a></td>
  </table>
  <table border=0 cellspacing=0 cellpadding=0 width=100%
bgcolor=000000><tr><td>
      <table width=100% border=0 cellspacing=1 cellpadding=3>
        <tr> 
          <td colspan=1 bgcolor=CCCCCC>Name</td>
          <td bgcolor=CCCCCC>Work</td>
          <td bgcolor=CCCCCC>Home</td>
          <td bgcolor=CCCCCC>Cell</td>
          <td bgcolor=CCCCCC>Pager</td>
          <td bgcolor=CCCCCC>Department</td>
        </tr>
        <tr align=\"left\" valign=\"top\">";
            
 
  while ($myrow = mysql_fetch_row($result)) {
   if ($sort == "lname" || $sort == "dept"){
   
   printf("<td bgcolor=FFFFFF><div align=\"left\">%s, %s</div></td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   </tr>\n", $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[6],
$myrow[7], $myrow[1]);
   
   
     } else {
      
   printf("<td bgcolor=FFFFFF><div align=\"left\">%s %s</div></td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   <td bgcolor=FFFFFF>%s</td>
   </tr>\n", $myrow[3], $myrow[2], $myrow[4], $myrow[5], $myrow[6],
$myrow[7], $myrow[1]);
   
   } //end if
  } //end while
 
 echo "
      </table>
    </td></tr></table><br>
   <br><a href=\"/\">Home</a>";
 
 } // End if        
 

} else{
 
 
 
 
 
  // display form
 
 
 
?>
<center><br><br><br><br>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#000000">
      <table width="100%" border="0" cellspacing="1" cellpadding="3">
        <tr> 
          <td bgcolor="#CCCCCC" align="center" colspan="2"><font
size="+1">Search 
            Phone Numbers</font></td>
        </tr>
        <tr>
   <form method="post" action=" http://192.9.201.104/index.php
<http://192.9.201.104/index.php> "> 
          <td bgcolor="#FFFFFF" height="23">First Name:</td>
          <td bgcolor="#FFFFFF" height="23"><input type="text"
name="fname"></td>
        </tr>
        <tr> 
          <td bgcolor="#FFFFFF" height="23">Last Name:</td>
          <td bgcolor="#FFFFFF" height="23"><input type="text"
name="lname"></td>
        </tr>
        <tr>
          <td bgcolor="#FFFFFF" height="23">Department:</td>
          <td bgcolor="#FFFFFF" height="23">
        <SELECT NAME="dept_pulldown">
   <OPTION VALUE="" SELECTED>Departments
   <OPTION VALUE="all">All Departments
           <OPTION VALUE="Accounting">Accounting
  <OPTION VALUE="Ad Services">Ad Services
  <OPTION VALUE="Admin HR">Admin HR
  <OPTION VALUE="Advertising">Advertising
  <OPTION VALUE="Building">Building
  <OPTION VALUE="Circulation">Circulation
  <OPTION VALUE="Classified">Classified
  <OPTION VALUE="East Shore">East Shore
  <OPTION VALUE="Editorial">Editorial
  <OPTION VALUE="IT">IT
  <OPTION VALUE="Marketing">Marketing
  <OPTION VALUE="Production">Production
  <OPTION VALUE="Reception">Reception
   </SELECT>
         </td>
        </tr>
          <td colspan=2 bgcolor="#CCCCCC" align="center"
valign="bottom"><font size=-1>
            Sort by: First<input type="radio" name="sort"
value="fname">&nbsp;&nbsp;Last<input type="radio" name="sort" value="lname"
Checked>&nbsp;&nbsp;Dept.<input type="radio" name="sort" value="dept">
          <br><br></font>
  <input type="submit" name="search" value="Search">
      
            </form>
          </td>
        </tr>
      </table>
    </td>
 
  </tr>
</table>
<br><b>Note:</b> You MUST type entire first or last name, <br>
there are no boolean or wildcard functions available.
</center>
 
<?php
} // end if
 
include ("footer.php");
?>

 

Travis Trout 
   Production Support 

The Mobile Press Register 
401 North Water Street 
Mobile Alabama 36602 

Phone: (251) 219-5263 
Email:  [EMAIL PROTECTED] 

-----Original Message-----
From: Trout, Travis [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 10:44 AM
To: 'PHP Mailing list'
Subject: [PHP] Old PHP files not working



I am having a very weird problem and am not sure if it is the files or the
php parser it self. I currently have a server running Apache 1.3.23, MySQL
3.23.47, and PHP 4.1.1 on Red Hat 7.2. I have another test server that I
have just set up with the latest of the three packages above on RH 7.3.

My problem is that when I copy the files from the old server to this one it
doesn't seem to want to parse all of the .php files. It is a very simple
site. There is a header.php, footer.php, config.php, and a index.php file.
All of the files except for the index.php parse correctly. Although, the
index.php file doesn't want to do anything with the database. It connects
and chooses the database that I want, but when I try to query the db it
doesn't do anything. It doesn't give a warning or an error at all. What is
weird is if I rewrite the code from scratch on the new PC and then run it,
it works fine. I have checked permissions and everything is same between the
two files. Both of the files have been edited and created using either gedit
or vi. 

Some of you may be saying that if I can re-type it and it works fine for
such a small site then just re-type it and let it go. The problem is this
site is small, but there are several others and one being 400+ php files
with over 1,000 lines of code and many of the files. 

I have attached a copy of the index.php file to see if any of you may be
able to see what is wrong with it. 

<<index.php>> 
Thank you, 

Travis Trout 

Reply via email to