473,385 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Calling for data to be displayed using the URL

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. I've used the $_GET command to attempt to pull the information from ID through my page, but it's still coming out as though the code is doing nothing. Even if it's simple it seems as though I don't know what needs to be manipulated in order to get it to work. Any help will be grateful!

Thanks,

Ph33red.


php:

<?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);
?>
Jul 31 '07 #1
2 1651
kovik
1,044 Expert 1GB
I've used the $_GET command to attempt to pull the information from ID through my page, but it's still coming out as though the code is doing nothing. Even if it's simple it seems as though I don't know what needs to be manipulated in order to get it to work.
Firstly, $_GET is not a command, it's an array.

Secondly, not once in your code do you use it.
Jul 31 '07 #2
Firstly, $_GET is not a command, it's an array.

Secondly, not once in your code do you use it.
Sorry, I seemed to paste the wrong code and didn't notice it.

Here is my code. At the moment it seems to be configured properly, yet right now it's not pulling any of the fields no matter the ID I attempt to pull from.:

<?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($_GET['Name']); ?> - <?php echo ucwords($_GET['Department_Title']); ?></div>
<div class="staffleft"><img src="<?php echo $_GET['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($_GET['Name']); ?></td>
</tr>
<tr>
<td><span class="stafftableheading">Department/Title:</span></td>
<td colspan="3"><?php echo ucwords($_GET['Department_Title']); ?></td>
</tr>
<tr>
<td><span class="stafftableheading">E-mail Address:</span></td>
<td colspan="3"><?php echo $_GET['Email_Address']; ?></td>
</tr>
<tr>
<td><span class="stafftableheading">Phone Number/Extension:</span></td>
<td width="36%"><?php echo $_GET['Phone_Number']; ?></td>
<td width="10%"><div align="right"><span class="stafftableheading">Ext</span>.</div></td>
<td width="8%"><?php echo $_GET['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);
?>
Jul 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Ksenia Marasanova | last post by:
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed....
9
by: cooldv | last post by:
i know how to replace the sign " when SUBMITTING a form in asp by this code: message = Replace(usermessage, "'", "''"). My problem is DISPLAYING data in an asp FORM, from an an access database,...
5
by: niftyhawk | last post by:
Hi, Can anybody give me a simple example of how to Call Web Services from Mozilla based Browsers ? I can call web services from IE browser using web service behavior file, without any problems....
2
by: Andy | last post by:
Hello, I have a question regarding how to format a date in VB so that I can call it from a query and get results. I'm calling functions in the query because that was the only way I found I could...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
0
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
0
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
4
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript"...
47
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
4
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.