I have a Db (sitesurvey database) I get the thable joins to work but it is only pulling the info from the last input into the DB below are the queries first one is from survey_list.php and the second is from Survey_details.php As is said the info is being pulled but only from the last info put into the DB
survey_list.php
PHP Code:
$query2 = "SELECT cir_id from survey WHERE survey.f_city = '$id'";
$result2 = mysql_db_query($database, $query2, $connection) or die ("Error in query: $query2. " . mysql_error());
thansk for the help but that did not work Here is what i have
this is the whole script from top to botto, html included
Hope this not to much info but i wanted to give you the whole picture
PHP Code:
<?
// survey_details.php - display the site surveys
// includes
include("config.php");
include("functions.php");
/*
// check for missing parameters
if (!$cir_id || $cir_id == "")
{
header("Location:error.php");
exit;
}
*/
// 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 DISTINCT 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 " <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
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>
move that from there, down to the bottom (outside the while loop).
Also, using the wile it will print every single item in the database. If you want a specific one, remove the while and add a AND to your query to select one of the surveys by its id (you will need another page which lists them all).
move that from there, down to the bottom (outside the while loop).
Also, using the wile it will print every single item in the database. If you want a specific one, remove the while and add a AND to your query to select one of the surveys by its id (you will need another page which lists them all). [/B]
I Get the first part But the while and the AND thing I just don't get what you are talking about could you please give me an example thanks a million
OK... Tell me this.. do you want all of the results to be shown on ONE page or do you want multiple pages and each page to show a set of results from the survey?