Calling for data to be displayed using the URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ph33red
Forum Newbie
Posts: 6
Joined: Mon Jul 30, 2007 2:05 pm

Calling for data to be displayed using the URL

Post by ph33red »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,  I'm having a problem getting my code to pull the appropriate information when I call for it via URL. (example:  http://..../.php?id=2).  For some reason I can't get it to pull the information for ID #2 (or any ID over 1) and input that information into my dynamic page.  No matter what ID i type, or even if I neglect to type in an ID to begin with, it displays the same information.  What am I doing wrong?  The entire code for my page is pasted below.  If anyone could help I would be grateful.  I know there's something simple i'm over looking, but I can't figure out what.

Thanks,

Ph33red.

Code: Select all

<?php require_once('connect.php'); ?>
<?php 	
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;
}
}
mysql_select_db($database_StaffDirectory, $StaffDirectory);
$query_StaffDirectory = "SELECT * FROM staffdirectory";
$StaffDirectory = mysql_query($query_StaffDirectory, $StaffDirectory) or die(mysql_error());
$row_StaffDirectory = mysql_fetch_assoc($StaffDirectory);
$totalRows_StaffDirectory = mysql_num_rows($StaffDirectory);
$result = mysql_fetch_assoc($StaffDirectory);

if (isset($ID)) //this is looking at a specific ID
  {
$query_StaffDirectory="SELECT * from staffdirectory where id='$ID'";
    //$ID is the number after the ID= in your browser
    $query_StaffDirectory=mysql_query($StaffDirectory);
      $row_StaffDirectory=mysql_fetch-array($StaffDirectory);
    print "$row_StaffDirectory[$Result]";
    //prints the text or entries of the field with the set ID
  }	
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Testing</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">


<link href="style.css" rel="stylesheet" type="text/css">
<script language=javascript src=activateSF123.js></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.staffleft {
	height: 233px;
	width: 350px;
	border: 2px groove #FFFFFF;
	float: left;
	margin-top: 20px;
	margin-right: 2px;
	margin-bottom: 15px;
	margin-left: 25px;
	text-align: center;
	white-space: normal;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: capitalize;
	text-decoration: none;
	color: #FFFFFF;
	padding: 3px;
}
.newblock {
	margin-top: 45px;
	margin-right: 15px;
	margin-bottom: 15px;
	margin-left: 15px;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 5px;
	padding-left: 0px;
	text-align: center;
	vertical-align: bottom;
}
.stafftable {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
	margin: 0px;
	padding: 2px;
}
.staffright {
	padding: 3px;
	float: right;
	height: 233px;
	width: 370px;
	margin-top: 20px;
	margin-right: 5px;
	margin-bottom: 15px;
	margin-left: 0px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.staffcenter {
	padding: 3px;
	width: 600px;
	margin-top: 15px;
	margin-right: auto;
	margin-bottom: 15px;
	margin-left: auto;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: large;
	font-style: normal;
	line-height: normal;
	font-weight: bold;
	font-variant: normal;
	color: #FFFFFF;
	text-align: center;
	white-space: normal;
	text-transform: capitalize;
}
.stafftableheading {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<table height="77%" border="0"  align="left" cellpadding="0" cellspacing="0" style="height:100% ">
<tr>	
	  <td width="766" height="495" valign="top" style="height:100% ">
	  	<table width="776" border="0" cellpadding="0" cellspacing="0" style="height:100% ">
<tr>
				<td valign="top" width="1180" height="274" style="">				
				  <div align="center" id="nav">
				    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="766" height="227">
				      <param name="movie" value="flash/main.swf">
				      <param name="quality" value="high">
				      <param name="menu" value="false">
				      <param name="wmode" value="transparent">
				      <!--[if !IE]> <-->
    <object data="flash/main.swf"
            width="766" height="227" type="application/x-shockwave-flash"> 
     <param name="quality" value="high">
     <param name="menu" value="false">
	 <param name="wmode" value="transparent">
     <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
     FAIL (the browser should render some flash content, not this).
    </object>
    <!--> <![endif]-->
			                    </object>
                                <script type="text/javascript" src="fixit.js"></script>
				    <ul>
                      <li><a href="laser-custom-tube-cutting.html">Tube Laser Cutting</a></li>
				      <li><a href="flat-metal-laser-cutting.html">Flat Laser Cutting</a></li>
				      <li><a href="cnc-turning.html">CNC Turning</a></li>
				      <li><a href="metalfabrication.html">Metal Fabrication</a></li>
				      <li><a href="multimedia.html">Video Library</a></li>
				      <li><a href="about-us.html">About Us</a></li>
				      <li><a href="our-clients.html">Clients</a></li>
				      <li><a href="careers.html">Careers</a></li>
				      <li><a href="contact-us.html">Contact Us</a></li>
				      <li><a href="quote.html">Request A Quote</a></li>
			        </ul>
			      </div>			  </td>
		  </tr>
			<tr>
            
			  <td valign="top" width="1180"  style="" class="content">
			    
		      <div class="staffcenter"><?php echo ucwords($row_StaffDirectory['Name']); ?> - <?php echo ucwords($row_StaffDirectory['Department_Title']); ?></div>
              <div class="staffleft"><img src="<?php echo $row_StaffDirectory['Photo']; ?>" alt="Laser Dynamics Staff Directory" width="350" height="233"></div>
              <div class="staffright">
                <table width="95%" border="0" align="center" class="stafftable">
                  <tr>
                    <td width="46%"><span class="stafftableheading">Name:</span></td>
                    <td colspan="3"><?php echo ucwords($row_StaffDirectory['Name']); ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">Department/Title:</span></td>
                    <td colspan="3"><?php echo ucwords($row_StaffDirectory['Department_Title']); ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">E-mail Address:</span></td>
                    <td colspan="3"><?php echo $row_StaffDirectory['Email_Address']; ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">Phone Number/Extension:</span></td>
                    <td width="36%"><?php echo $row_StaffDirectory['Phone_Number']; ?></td>
                    <td width="10%"><div align="right"><span class="stafftableheading">Ext</span>.</div></td>
                    <td width="8%"><?php echo $row_StaffDirectory['Extension']; ?></td>
                  </tr>
                </table>
              </div>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <div class="newblock">
		        <div align="center"></div>
		      </div>		      </td>
		  </tr>
			<tr>
				<td valign="top" width="1180" height="34" style="background-image:url(images/bottom.gif) " class="footer"><div style="margin:9 0 0 51px "><b><a href="terms.html">Terms of Use</a> |<a href="privacy.html"> Privacy Statement</a><a href="privacy.html"></a></b><img alt="" src="images/spacer.gif" width="314px" height="1px">  &copy; Testing</div></td>
		  </tr>
		</table>
    </td>
  </tr>
</table>

</body>
</html>
<?php
	echo $html_output;
mysql_free_result($StaffDirectory);
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

if you want to get the value of id passed in the url then you need to use $_GET['id'].
ph33red
Forum Newbie
Posts: 6
Joined: Mon Jul 30, 2007 2:05 pm

Post by ph33red »

How would I put this in my script? I'm sorry I'm just very confused. :?
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

$ID = $_GET['id'] ;

Now you an use $ID in your script.

FYI, $ID should be escaped before you use it in a query using something like mysql_real_escape_string().
ph33red
Forum Newbie
Posts: 6
Joined: Mon Jul 30, 2007 2:05 pm

Post by ph33red »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


After adding the $_GET tag I get this error in my code.  

"Fatal error: Unsupported operand types in /home/testing/public_html/kyle/viewstaff.php on line 45"

Anyone have any idea what I'm doing wrong?  I don't mean to sound incompetent here- just having a difficulty understanding is all.

Code: Select all

<?php require_once('connect.php'); ?>
<?php 	
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;
}
}
mysql_select_db($database_StaffDirectory, $StaffDirectory);
$query_StaffDirectory = "SELECT * FROM staffdirectory";
$StaffDirectory = mysql_query($query_StaffDirectory, $StaffDirectory) or die(mysql_error());
$row_StaffDirectory = mysql_fetch_assoc($StaffDirectory);
$totalRows_StaffDirectory = mysql_num_rows($StaffDirectory);
$result = mysql_fetch_assoc($StaffDirectory);
$ID = $_GET['id'] ;
mysql_real_escape_string($ID);

if (isset($ID)) //this is looking at a specific ID
  {
$query_StaffDirectory="SELECT * from staffdirectory where id='$ID'";
    //$ID is the number after the ID= in your browser
    $query_StaffDirectory=mysql_query($StaffDirectory);
      $row_StaffDirectory=mysql_fetch-array($StaffDirectory);
    print "$row_StaffDirectory[$Result]";
    //prints the text or entries of the field with the set ID
  }	
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Staff Directory </title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link href="style.css" rel="stylesheet" type="text/css">
<script language=javascript src=activateSF123.js></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.staffleft {
	height: 233px;
	width: 350px;
	border: 2px groove #FFFFFF;
	float: left;
	margin-top: 20px;
	margin-right: 2px;
	margin-bottom: 15px;
	margin-left: 25px;
	text-align: center;
	white-space: normal;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: capitalize;
	text-decoration: none;
	color: #FFFFFF;
	padding: 3px;
}
.newblock {
	margin-top: 45px;
	margin-right: 15px;
	margin-bottom: 15px;
	margin-left: 15px;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 5px;
	padding-left: 0px;
	text-align: center;
	vertical-align: bottom;
}
.stafftable {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
	margin: 0px;
	padding: 2px;
}
.staffright {
	padding: 3px;
	float: right;
	height: 233px;
	width: 370px;
	margin-top: 20px;
	margin-right: 5px;
	margin-bottom: 15px;
	margin-left: 0px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.staffcenter {
	padding: 3px;
	width: 600px;
	margin-top: 15px;
	margin-right: auto;
	margin-bottom: 15px;
	margin-left: auto;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: large;
	font-style: normal;
	line-height: normal;
	font-weight: bold;
	font-variant: normal;
	color: #FFFFFF;
	text-align: center;
	white-space: normal;
	text-transform: capitalize;
}
.stafftableheading {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<table height="77%" border="0"  align="left" cellpadding="0" cellspacing="0" style="height:100% ">
<tr>	
	  <td width="766" height="495" valign="top" style="height:100% ">
	  	<table width="776" border="0" cellpadding="0" cellspacing="0" style="height:100% ">
<tr>
				<td valign="top" width="1180" height="274" style="">				
				  <div align="center" id="nav">
				    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="766" height="227">
				      <param name="movie" value="flash/main.swf">
				      <param name="quality" value="high">
				      <param name="menu" value="false">
				      <param name="wmode" value="transparent">
				      <!--[if !IE]> <-->
    <object data="flash/main.swf"
            width="766" height="227" type="application/x-shockwave-flash"> 
     <param name="quality" value="high">
     <param name="menu" value="false">
	 <param name="wmode" value="transparent">
     <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
     FAIL (the browser should render some flash content, not this).
    </object>
    <!--> <![endif]-->
			                    </object>
                                <script type="text/javascript" src="fixit.js"></script>
				    <ul>
                      <li><a href="laser-custom-tube-cutting.html">Tube Laser Cutting</a></li>
				      <li><a href="flat-metal-laser-cutting.html">Flat Laser Cutting</a></li>
				      <li><a href="cnc-turning.html">CNC Turning</a></li>
				      <li><a href="metalfabrication.html">Metal Fabrication</a></li>
				      <li><a href="multimedia.html">Video Library</a></li>
				      <li><a href="about-us.html">About Us</a></li>
				      <li><a href="our-clients.html">Clients</a></li>
				      <li><a href="careers.html">Careers</a></li>
				      <li><a href="contact-us.html">Contact Us</a></li>
				      <li><a href="quote.html">Request A Quote</a></li>
			        </ul>
			      </div>			  </td>
		  </tr>
			<tr>
            
			  <td valign="top" width="1180"  style="" class="content">
			    
		      <div class="staffcenter"><?php echo ucwords($row_StaffDirectory['Name']); ?> - <?php echo ucwords($row_StaffDirectory['Department_Title']); ?></div>
              <div class="staffleft"><img src="<?php echo $row_StaffDirectory['Photo']; ?>" alt="Laser Dynamics Staff Directory" width="350" height="233"></div>
              <div class="staffright">
                <table width="95%" border="0" align="center" class="stafftable">
                  <tr>
                    <td width="46%"><span class="stafftableheading">Name:</span></td>
                    <td colspan="3"><?php echo ucwords($row_StaffDirectory['Name']); ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">Department/Title:</span></td>
                    <td colspan="3"><?php echo ucwords($row_StaffDirectory['Department_Title']); ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">E-mail Address:</span></td>
                    <td colspan="3"><?php echo $row_StaffDirectory['Email_Address']; ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">Phone Number/Extension:</span></td>
                    <td width="36%"><?php echo $row_StaffDirectory['Phone_Number']; ?></td>
                    <td width="10%"><div align="right"><span class="stafftableheading">Ext</span>.</div></td>
                    <td width="8%"><?php echo $row_StaffDirectory['Extension']; ?></td>
                  </tr>
                </table>
              </div>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <div class="newblock">
		        <div align="center"></div>
		      </div>		      </td>
		  </tr>
			<tr>
				<td valign="top" width="1180" height="34" style="background-image:url(images/bottom.gif) " class="footer"><div style="margin:9 0 0 51px "><b><a href="terms.html">Terms of Use</a> |<a href="privacy.html"> Privacy Statement</a><a href="privacy.html"></a></b><img alt="" src="images/spacer.gif" width="314px" height="1px">  &copy; Test</div></td>
		  </tr>
		</table>
    </td>
  </tr>
</table>

</body>
</html>
<?php
	echo $html_output;
mysql_free_result($StaffDirectory);
?>
:? :?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Look carefully at

Code: Select all

$row_StaffDirectory=mysql_fetch-array($StaffDirectory);
Also of note: mysql_real_escape_string() won't end up doing any protecting if you do not assign its output to a variable being used.
ph33red
Forum Newbie
Posts: 6
Joined: Mon Jul 30, 2007 2:05 pm

Post by ph33red »

Would this be acceptable for protecting $ID?

Code: Select all

$ID = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($ID) : mysql_escape_string($ID);
As for mysql_fetch-array, am I using the right function? Before I added $_GET it would never crash at this particular point. :?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ph33red wrote:As for mysql_fetch-array, am I using the right function? Before I added $_GET it would never crash at this particular point.
There is no such function with that specific name. mysql_fetch_array() exists, however.
ph33red
Forum Newbie
Posts: 6
Joined: Mon Jul 30, 2007 2:05 pm

Post by ph33red »

I removed the fetch-array function, and no longer get any errors when executing my code, yet when I add a respective ID number (eg: .php?id=2) the results from id 1 are still being displayed. What exactly have I missed? Here is my code thus far. Thanks to everyone so much for their help!

Code: Select all

<?php require_once('Connections/StaffDirectory.php'); ?>
<?php 	
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;
}
}
mysql_select_db($database_StaffDirectory, $StaffDirectory);
$query_StaffDirectory = "SELECT * FROM staffdirectory";
$StaffDirectory = mysql_query($query_StaffDirectory, $StaffDirectory) or die(mysql_error());
$row_StaffDirectory = mysql_fetch_assoc($StaffDirectory);
$totalRows_StaffDirectory = mysql_num_rows($StaffDirectory);
$result = mysql_fetch_assoc($StaffDirectory);
$ID = $_GET['id'] ;
$ID = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($ID) : mysql_escape_string($ID);

if (isset($ID)) //this is looking at a specific ID
  {
$query_StaffDirectory="SELECT * from staffdirectory where id='$ID'";
    //$ID is the number after the ID= in your browser
    $query_StaffDirectory=mysql_query($StaffDirectory);
    print "$row_StaffDirectory[$Result]";
    //prints the text or entries of the field with the set ID
  }	
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Staff Directory </title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link href="style.css" rel="stylesheet" type="text/css">
<script language=javascript src=activateSF123.js></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.staffleft {
	height: 233px;
	width: 350px;
	border: 2px groove #FFFFFF;
	float: left;
	margin-top: 20px;
	margin-right: 2px;
	margin-bottom: 15px;
	margin-left: 25px;
	text-align: center;
	white-space: normal;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: capitalize;
	text-decoration: none;
	color: #FFFFFF;
	padding: 3px;
}
.newblock {
	margin-top: 45px;
	margin-right: 15px;
	margin-bottom: 15px;
	margin-left: 15px;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 5px;
	padding-left: 0px;
	text-align: center;
	vertical-align: bottom;
}
.stafftable {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
	margin: 0px;
	padding: 2px;
}
.staffright {
	padding: 3px;
	float: right;
	height: 233px;
	width: 370px;
	margin-top: 20px;
	margin-right: 5px;
	margin-bottom: 15px;
	margin-left: 0px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.staffcenter {
	padding: 3px;
	width: 600px;
	margin-top: 15px;
	margin-right: auto;
	margin-bottom: 15px;
	margin-left: auto;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: large;
	font-style: normal;
	line-height: normal;
	font-weight: bold;
	font-variant: normal;
	color: #FFFFFF;
	text-align: center;
	white-space: normal;
	text-transform: capitalize;
}
.stafftableheading {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<table height="77%" border="0"  align="left" cellpadding="0" cellspacing="0" style="height:100% ">
<tr>	
	  <td width="766" height="495" valign="top" style="height:100% ">
	  	<table width="776" border="0" cellpadding="0" cellspacing="0" style="height:100% ">
<tr>
				<td valign="top" width="1180" height="274" style="">				
				  <div align="center" id="nav">
				    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="766" height="227">
				      <param name="movie" value="flash/main.swf">
				      <param name="quality" value="high">
				      <param name="menu" value="false">
				      <param name="wmode" value="transparent">
				      <!--[if !IE]> <-->
    <object data="flash/main.swf"
            width="766" height="227" type="application/x-shockwave-flash"> 
     <param name="quality" value="high">
     <param name="menu" value="false">
	 <param name="wmode" value="transparent">
     <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
     FAIL (the browser should render some flash content, not this).
    </object>
    <!--> <![endif]-->
			                    </object>
                                <script type="text/javascript" src="fixit.js"></script>
				    <ul>
                      <li><a href="laser-custom-tube-cutting.html">Tube Laser Cutting</a></li>
				      <li><a href="flat-metal-laser-cutting.html">Flat Laser Cutting</a></li>
				      <li><a href="cnc-turning.html">CNC Turning</a></li>
				      <li><a href="metalfabrication.html">Metal Fabrication</a></li>
				      <li><a href="multimedia.html">Video Library</a></li>
				      <li><a href="about-us.html">About Us</a></li>
				      <li><a href="our-clients.html">Clients</a></li>
				      <li><a href="careers.html">Careers</a></li>
				      <li><a href="contact-us.html">Contact Us</a></li>
				      <li><a href="quote.html">Request A Quote</a></li>
			        </ul>
			      </div>			  </td>
		  </tr>
			<tr>
            
			  <td valign="top" width="1180"  style="" class="content">
			    
		      <div class="staffcenter"><?php echo ucwords($row_StaffDirectory['Name']); ?> - <?php echo ucwords($row_StaffDirectory['Department_Title']); ?></div>
              <div class="staffleft"><img src="<?php echo $row_StaffDirectory['Photo']; ?>" alt="Laser Dynamics Staff Directory" width="350" height="233"></div>
              <div class="staffright">
                <table width="95%" border="0" align="center" class="stafftable">
                  <tr>
                    <td width="46%"><span class="stafftableheading">Name:</span></td>
                    <td colspan="3"><?php echo ucwords($row_StaffDirectory['Name']); ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">Department/Title:</span></td>
                    <td colspan="3"><?php echo ucwords($row_StaffDirectory['Department_Title']); ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">E-mail Address:</span></td>
                    <td colspan="3"><?php echo $row_StaffDirectory['Email_Address']; ?></td>
                  </tr>
                  <tr>
                    <td><span class="stafftableheading">Phone Number/Extension:</span></td>
                    <td width="36%"><?php echo $row_StaffDirectory['Phone_Number']; ?></td>
                    <td width="10%"><div align="right"><span class="stafftableheading">Ext</span>.</div></td>
                    <td width="8%"><?php echo $row_StaffDirectory['Extension']; ?></td>
                  </tr>
                </table>
              </div>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <p>&nbsp;</p>
		      <div class="newblock">
		        <div align="center"></div>
		      </div>		      </td>
		  </tr>
			<tr>
				<td valign="top" width="1180" height="34" style="background-image:url(images/bottom.gif) " class="footer"><div style="margin:9 0 0 51px "><b><a href="terms.html">Terms of Use</a> |<a href="privacy.html"> Privacy Statement</a><a href="privacy.html"></a></b><img alt="" src="images/spacer.gif" width="314px" height="1px">  &copy; Test</div></td>
		  </tr>
		</table>
    </td>
  </tr>
</table>

</body>
</html>
<?php
	echo $html_output;
mysql_free_result($StaffDirectory);
?>
ph33red
Forum Newbie
Posts: 6
Joined: Mon Jul 30, 2007 2:05 pm

Post by ph33red »

Further evaluation lead me to change the lines:

Code: Select all

<td colspan="3"><?php echo ucwords($row_StaffDirectory['Department_Title']); ?></td>
to

Code: Select all

<td colspan="3"><?php echo $_GET['Department_Title']; ?></td>
Which is where I am at now. It doesn't pull any information now, yet it also does not produce any error. I have to be close at this point, anyone have any ideas?
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

You should really drop what you are doing and get a book on php and read it. A good place to start is 'learning php' from oreilly press.

$_GET is an array of any arguments posted on the URL

so if the URL is http://mysite.com/index.php?id=10&name=fred

then $_GET['id'] will be 10 and $_GET['name'] will be fred. There will be nothing else in $_GET. You will need to get your department_title from the database results.

We could continue stabbing away at this and solve your problem, however you will still be running into these problems in your next script until you get a handle on the basics and understand exactly what this code is doing.
Post Reply