I have been reading In books and on message boards but i could not find my answer. The problem is that the variables are passing but the db is only quering the last entry in the db Below is my code from the 2 scripts survey_list.php and survey_details.php the list 1 is the script that generates the URL
survey_list.php
echo "<li><a href=survey_details.php?cir_id=$cir_id>$cir_id</a>";
survey_details.php this is the whole script
<?
// survey_details.php - display the site surveys
// includes
include("config.php");
include("functions.php");
// check for missing parameters
/*
header("Location:error.php");
exit;
}
*/
$cir_id = $_GET['cir_id'];
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
// get site survey details
// use a join to get data from different tables
$query = "SELECT survey.cir_id, survey.cust_name,
survey.cust_contact, survey.cust_phone,
survey.ext, phonelist.phonelist, survey.altphnum, survey.cust_address, power.power,
survey.dist_power, powerstrip.powerstrip, equptmount.equptmount, space.space,
survey.concerns, ilecextend.ilecextend,
focalextend.focalextend, survey.addinfo,
survey.tech_name, survey.tech_phone,
survey.lec_foc, survey.focal_foc, city.city,
survey.survey_date from survey, phonelist,
power, powerstrip, equptmount, space,
ilecextend, focalextend, city
WHERE phonelist.id = survey.f_altphone
AND power.id = survey.f_power AND
powerstrip.id = survey.f_powerstrip AND
equptmount.id = survey.f_eqptmount AND
space.id = survey.f_space AND
ilecextend.id = survey.f_ilecextend AND
focalextend.id = survey.f_focalextend AND
city.id = survey.f_city AND
survey.cir_id = cir_id";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
// echo statements
echo " <p>$cir_id</p>";
echo " <p>$query</p>";
// echo "<br>";
// echo " <p>$result</p>";
// error chec
if (mysql_num_rows($result) <= 0)
{
header("Location:error.php");
exit;
}
else
{
// obtain data from resultset
while(list($cir_id, $cust_name, $cust_contact,
$cust_phone, $ext, $phonelist, $altphnum,
$cust_address, $power, $dist_power,
$powerstrip, $equptmount, $space,
$concerns, $ilecextend, $focalextend,
$addinfo, $tech_name, $tech_phone,
$lec_foc, $focal_foc, $city, $survey_date)
= mysql_fetch_row($result))
{
// what you want to do here
// clean up
// mysql_close($connection);
?>
<html>
<head>
</head>
<body bgcolor=white>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr><font size="+1">Customer Information</font>
<br><br>
<td colspan="4">Focal Circuit ID.
<input type="text" name="cir_id"
value="<? echo $cir_id; ?>" readonly></td>
</tr>
<tr>
<td colspan="4">Focal Customer Name
<input type="text" name="cust_name"
value="<? echo $cust_name; ?>" readonly></td>
</tr>
<tr>
<td colspan="4">Customer Contact <input type="text" name="cust_contact" value="<? echo $cust_contact; ?>" readonly></td>
</tr>
<tr>
<td>Customer Phone #<INPUT TYPE="text" NAME="cust_phone" MAXLENGTH=12 SIZE="12"
value="<? echo $cust_phone ?>" readonly></td>
<td>Extension<INPUT TYPE="text" NAME="ext" MAXLENGTH=5 SIZE="4" value="<? echo $ext; ?>" readonly></td>
<td>Alternate contact device <input type="text" name="altphone" value="<? echo $phonelist; ?>"
readonly></td>
<td>Phone Number<INPUT TYPE="text" NAME="phone" MAXLENGTH=12 SIZE="12" value="<? echo $altphnum; ?>" readonly ></td>
</tr>
<tr>
<td colspan="4">Customer Address <INPUT TYPE="text" NAME="cust_address" value="<? echo $cust_address; ?>" readonly></td>
</tr>
</table>
<hr width="100%" size="2">
<br>
<br>
<font size="+2">Site Survey</font><BR><BR>
Please Make sure the following is available where the equipment is to be installed.<BR>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td colspan="2">Are the proper Power requirements
available <INPUT TYPE="text" NAME="power"
value="<? echo $power; ?>" readonly></td>
</tr>
<tr>
<td>approx. distance to Power <INPUT TYPE="text" NAME="dist_power" value="<? echo $dist_power; ?>"> Ft.</td>
<td>Does Focal need to supply the Power Strip? (if the distance is over 5 Ft.)<INPUT TYPE="text" NAME="powerstrip" value="<? echo $powerstrip; ?>" readonly></td>
</tr>
<tr>
<td colspan="2">Method of mounting the Equipment <INPUT TYPE="text" NAME="equptmount" value="<? echo $equptmount; ?>" readonly></td>
</tr>
<tr>
<td colspan="2">Proper Space (At least 3sq. Ft.)<INPUT TYPE="text" NAME="space" value="<? echo $space; ?>" readonly></td>
</tr>
<tr>
<td colspan="2"><font color="red"><b>Potential Concerns</B></font> where the equipment is going to be installed.</td>
</tr>
<tr>
<td colspan="2"><TEXTAREA NAME="concerns" ROWS="6" COLS="40" readonly>
<?
echo "$concerns";
?>
</TEXTAREA></td>
</tr>
</table>
<hr width="100%" size="2">
<br>
<br>
Please Verify the Dmarc Location<br>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td>Is the Dmarc extended <INPUT TYPE="text" NAME="ilecextend" value="<? echo $ilecextend; ?>" readonly></td>
</tr>
<tr>
<td>Do we have to extend the circuit. <INPUT TYPE="text" NAME="focalextent" value="<? echo $focalextend; ?>" readonly></td>
</tr>
<tr>
<td>Please give us any additional information: (I.E. Is the 66 Block far away from the location Of the IAD Equipment)</td>
</tr>
<tr>
<td><TEXTAREA NAME="addinfo" ROWS="6" COLS="40" readonly >
<?
echo "$addinfo";
?>
</TEXTAREA></td>
</tr>
</table>
<hr width="100%" size="2">
<br>
<br>
Site Survey Preformed by:<br>
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td colspan="2">Tech Name <input type="text" name="tech_name" value="<? echo $tech_name; ?>" readonly></td>
</tr>
<tr>
<td colspan="2">Tech Phone Number <INPUT TYPE="text" NAME="tech_phone" MAXLENGTH=12 SIZE="12" value="<? echo $tech_phone; ?>" readonly></td>
</tr>
<tr>
<td>LEC Loop FOC date <input type=text size=10 name=lec_foc value="<? echo $lec_foc; ?>" readonly></td>
<td>Focal FOC date <input type=text size=10 name=focal_foc value="<? echo $focal_foc; ?>" readonly ></td>
</tr>
<tr>
<td colspan="2">What City sold this Service <INPUT TYPE="text" NAME="city" value="<? echo $city; ?>" readonly></td>
</tr>
<tr>
<td colspan="2">Date Survey was Preformed on <input type=text size=10 name=date value="<? echo $survey_date; ?>" readonly></td>
</tr>
</table>
</body>
</html>
<?
}
}
?>
Any help would be great Thanks a million 😃