Calling for data to be displayed using the URL
Posted: Mon Jul 30, 2007 2:14 pm
feyd | Please use
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> </p>
<p> </p>
<p> </p>
<p> </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"> © 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]