Jump to content

Staff Directory for Work (Just Stop Working)


Kaizen Maven

Recommended Posts

Hi,

 

We have a staff directory at work that pulls: first name, last name, phone number, etc from a mySQL DB and displays them in a table.  We also have a backend section where you can input the information.  For some reason, I want to input a new employee in the backend and it didn't show up on the frontend of our site.

 

Nothing was touched, it just seemed to stop working.

 

If need be I can post the code....

 

Thank you for any help on this:

Just to make sure I am thinking along the same lines, you are doing something similar to this, right?

$server = "[sERVER]";
$DBuser = "[uSERNAME]"; 
$DBpass = "[PASSWORD]";
$DB = "[DATABASE NAME]";
$table = "[TABLE NAME]"; 

mysql_connect($server,$DBuser,$DBpass);
mysql_select_db($DB);
$info = mysql_query("SELECT * FROM ".$table."");

while ($qry = mysql_fetch_array($info)) {
echo '<tr><td>'.$qry[FIRST_NAME].'</td><td>'.$qry[LAST_NAME].'</td><td>'.$qry[PHONE_NUMBER].'</td></tr>';
}

@GhettoT,

 

Yes more or less:

 

Here is the actual code itself

 

<?php include('../includes_global/db_connect.php'); ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="Tulane, Tulane University, Howard-Tilton, Memorial, Library, New Orleans, special collections, rare books, jazz archive, manuscripts, latin american library, latin, american, music and media, maxwell music library, music library">
<meta name="description" content="Welcome to the web site for the main library at Tulane University (New Orleans, LA USA), Howard-Tilton Memorial Library.">
<meta http-equiv="Content-Language" content="EN-US">
<meta name="Abstract" content="Welcome to the web site for the main library at Tulane University (New Orleans, LA USA), Howard-Tilton Memorial Library.">
<meta name="Robots" content="index,follow">
<meta name="author" content="Christopher Boudy">
<title>Howard Tilton Memorial Library at Tulane University (Library Staff: Staff Directory)</title>
<link rel="stylesheet" type="text/css" href="../css/layouts/staff_layout.css">
<link rel="stylesheet" type="text/css" href="../css/main.css">
<link rel="stylesheet" type="text/css" href="../css/menus/staff_side_menu.css">
<link rel="stylesheet" type="text/css" href="../css/nav_menu.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="../css/ie_nav_menu.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="../css/ie7_nav_menu.css">
<![endif]-->
<link rel="alternate stylesheet" type="text/css" href="../css/medium.css" title="A">
<link rel="alternate stylesheet" type="text/css" href="../css/large.css" title="A+">
<script src="../js/styleswitcher.js" type="text/javascript"></script>
<link rel="shortcut icon" href="../images/favicon.ico">
</head>


<body>

<!-- Jump Links -->
<?php include('../includes_global/jumplinks.php'); ?>

<!-- Off Campus Login -->
<?php include('../includes_global/off_campus_link.php'); ?>


<!-- Text Resize -->
<?php include('../includes_global/textresize.php'); ?>

<div id="container">


<div id="header">
<!-- Top Navigational Menu -->
<?php include('../includes_global/nav_menu.php'); ?>
</div>


	 <div id="left">

<!-- Side Navigational Menu -->
<?php include('../includes_local/staff_side_nav.php'); ?>


   <div class="sidelinks">
  <a href="http://dreamland.tcs.tulane.edu/~testlib/staff/staff_directory.php?order1=lastName&ascdesc1=asc" 
  title="View By Last Name">
  <img src="../images/lname.gif" alt="View By Last Name" width="30" height="30" class="left">  View By Last Name</a>


  <br>
  <br>
  	  
  <a href="http://dreamland.tcs.tulane.edu/~testlib/staff/staff_directory.php?order1=firstName&ascdesc1=asc" 
  title="View By First Name">
  <img src="../images/fname.gif" alt="View By First Name" width="30" height="30" class="left">  View By First Name</a>


  <br>
  <br>


  <a href="http://dreamland.tcs.tulane.edu/~testlib/staff/staff_directory.php?order1=dept&order2=dept_head&ascdesc1=asc&ascdesc2=desc" 
  title="View By Department">
  <img src="../images/dept.gif" alt="View By Department" width="50" height="30" class="left">  View By Dept</a>

  <br>
  <br>
  
  <a href="dept_info.php">
  <img src="../images/phone2.gif" alt="View By Department" width="50" height="40" class="left">  View By Phone</a>

  

</div>	
  </div>


<div id="right">
</div>


  	<div id="content">

<h1>Staff Directory</h1>

<strong>Note</strong>: A name in <strong>bold</strong> indicates a department head or main contact.
<br>

<?php
$order1 = $_GET['order1'];
$order2 = $_GET['order2'];
$ascdesc1 = $_GET['ascdesc1'];
$ascdesc2 = $_GET['ascdesc2'];

if (strlen($order1) < 1)
{
	$order1 = "lastName";
}

if (strlen($order2) < 1)
{
	$order2 = "";
}

if (strlen($ascdesc2) < 1)
{
	$ascdesc2 = "";
	$joiner = "";
}
else
{
	$joiner = ", ";
}

$sql1 = mysql_query('SELECT * FROM lnk_depts_staff l, library_staff s, library_depts d WHERE l.staff_id = s.id AND l.dept_id = d.id ORDER BY ' . $order1 . ' ' . $ascdesc1 . $joiner . $order2 . ' ' . $ascdesc2);

?>

<table>

<?php

if ($order2 == "dept_head")
{
?>

<tr>
	<td class="table_title">Department</td>
	<td class="table_title">Name</td>
	<td class="table_title">Title</td>
	<td class="table_title">Email</td>
	<td class="table_title">Phone Number</td>
</tr>

<?php
}
else
{

?>
<tr>
	<td class="table_title">Name</td>
	<td class="table_title">Email</td>
	<td class="table_title">Phone Number</td>
	<td class="table_title">Department</td>
	<td class="table_title">Title</td>
</tr>

<?php
}

while ($row1 = mysql_fetch_array($sql1))
{
	if ($row1['dept_head'] == "Y")
	{
	$strong = "<strong>";
	$endstrong = "</strong>";
	}
	else
	{
	$strong = "";
	$endstrong = "";
	}

	if ($a % 2 == 0) 
	{ 
	$class = 0; 
	} 
	else 
	{ 
	$class = 1; 
	}

	if ($order2 == "dept_head")
	{
	echo "<tr><td class=\"alt" . $class . "\">{$row1['dept']}</td>" .
	"<td class=\"alt" . $class . "\">" . $strong . "{$row1['firstName']}  {$row1['lastName']}". $endstrong . "</td>" .
	"<td class=\"alt" . $class . "\"><a href=\"mailto:{$row1['email']}\">{$row1['email']}</a></td>" .
	"<td class=\"alt" . $class . "\">{$row1['title']}</td>" .
	"<td class=\"alt" . $class . "\">(504){$row1['phone']}</td></tr>";
	$a++; 
	}
	if ($order2 != "dept_head")
	{
	echo "<tr><td class=\"alt" . $class . "\">" . $strong . "{$row1['firstName']}  {$row1['lastName']}". $endstrong . "</td>" .
	"<td class=\"alt" . $class . "\"><a href=\"mailto:{$row1['email']}\">{$row1['email']}</a></td>" .
	"<td class=\"alt" . $class . "\">(504){$row1['phone']}</td>".
	 "<td class=\"alt" . $class . "\">{$row1['dept']}</td>" .
	"<td class=\"alt" . $class . "\">{$row1['title']}</td></tr>";
	$a++; 
	}

}
?>
</table>



  </div>


<div id="footer">
<!-- Footer -->
<?php include('../includes_global/footer.php'); ?>
</div>

</div>

</body>
</html>

 

I just can't figure out what it stopped spitting out the info???

 

Would it have anything to do with the space in mySQL for this table:

 

Space usage :

Type Usage

Data 7,864 Bytes

Index 3,072 Bytes

Overhead 1,068 Bytes

Effective 9,868 Bytes

Total 10,936 Bytes

 

My overhead was red, and I didn't know what this meant.

i thank it is allways red but all you want this script to do is pull the name and number

 

Yes...another person wrote this php code a while back, and I'm somewhat of a n00b myself, so you'll have to forgive me.  I see that this snippet of code

 

<?php
}

while ($row1 = mysql_fetch_array($sql1))
{
	if ($row1['dept_head'] == "Y")
	{
	$strong = "<strong>";
	$endstrong = "</strong>";
	}
	else
	{
	$strong = "";
	$endstrong = "";
	}

	if ($a % 2 == 0) 
	{ 
	$class = 0; 
	} 
	else 
	{ 
	$class = 1; 
	}

	if ($order2 == "dept_head")
	{
	echo "<tr><td class=\"alt" . $class . "\">{$row1['dept']}</td>" .
	"<td class=\"alt" . $class . "\">" . $strong . "{$row1['firstName']}  {$row1['lastName']}". $endstrong . "</td>" .
	"<td class=\"alt" . $class . "\"><a href=\"mailto:{$row1['email']}\">{$row1['email']}</a></td>" .
	"<td class=\"alt" . $class . "\">{$row1['title']}</td>" .
	"<td class=\"alt" . $class . "\">(504){$row1['phone']}</td></tr>";
	$a++; 
	}
	if ($order2 != "dept_head")
	{
	echo "<tr><td class=\"alt" . $class . "\">" . $strong . "{$row1['firstName']}  {$row1['lastName']}". $endstrong . "</td>" .
	"<td class=\"alt" . $class . "\"><a href=\"mailto:{$row1['email']}\">{$row1['email']}</a></td>" .
	"<td class=\"alt" . $class . "\">(504){$row1['phone']}</td>".
	 "<td class=\"alt" . $class . "\">{$row1['dept']}</td>" .
	"<td class=\"alt" . $class . "\">{$row1['title']}</td></tr>";
	$a++; 
	}

}
?>

 

is doing most of the work.  But is there any reason why the information would just stop coming from the mySQL DB?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.