Current location: Hot Scripts Forums » Programming Languages » PHP » not displaying the correct info


not displaying the correct info

Reply
  #1 (permalink)  
Old 06-23-03, 11:36 AM
sparky sparky is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
not displaying the correct info

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());
    
    echo 
"<ul>";
        while(list(
$cir_id$id2) = mysql_fetch_row($result2))
        {
        echo 
"<li><a href=survey_details.php?cir_id=$cir_id>$id2 $cir_id </a>";
        }
    echo 
"</ul>";
    
echo 
"<p>";


survey_details.php
PHP Code:

$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
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);

// clean up
mysql_close($connection); 

Any help on this would be great thanks in advance
__________________
http://www.hitchcock-design.com/trou.../blue/logo.jpg

Smart People use Linux ( I'm trying to be one of them)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-24-03, 09:05 AM
Chris Boulton Chris Boulton is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Sydney, Australia
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

// obtain data from resultset

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); 
should be

PHP Code:

// 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


You werent looping through each result, thats why
__________________
Chris Boulton
SurfiOnline!
MyBulletinBoard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-24-03, 09:34 AM
sparky sparky is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
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


// 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>


<?
 
}
?>
__________________
http://www.hitchcock-design.com/trou.../blue/logo.jpg

Smart People use Linux ( I'm trying to be one of them)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-25-03, 02:48 AM
Chris Boulton Chris Boulton is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Sydney, Australia
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

// clean up

// mysql_close($connection); 
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).
__________________
Chris Boulton
SurfiOnline!
MyBulletinBoard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-25-03, 08:46 AM
sparky sparky is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
PHP Code:

// clean up

// mysql_close($connection); 
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
__________________
http://www.hitchcock-design.com/trou.../blue/logo.jpg

Smart People use Linux ( I'm trying to be one of them)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 06-26-03, 03:25 AM
Chris Boulton Chris Boulton is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Sydney, Australia
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
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?
__________________
Chris Boulton
SurfiOnline!
MyBulletinBoard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 06-26-03, 08:36 AM
sparky sparky is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for all the help I Figured out what was wrong late last night I forgot to add a ' in my query for $cir_id So it should have looke like this

PHP Code:

'$cir_id' 

not

PHP Code:

$cir_id 


thanks for the help
__________________
http://www.hitchcock-design.com/trou.../blue/logo.jpg

Smart People use Linux ( I'm trying to be one of them)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 06-26-03, 08:52 AM
Chris Boulton Chris Boulton is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Sydney, Australia
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
It shouldnt matter as long as $cur_id is going to be a numerical value.
__________________
Chris Boulton
SurfiOnline!
MyBulletinBoard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 06-26-03, 09:28 AM
sparky sparky is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
I should have been more clear (im sorry about that) the $cir_id is a text value

again sorry about not being as clear as i could have been now that is think about my orginal question
__________________
http://www.hitchcock-design.com/trou.../blue/logo.jpg

Smart People use Linux ( I'm trying to be one of them)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying all duplicate records in my table. dsumpter PHP 6 09-02-03 11:54 AM
Retreive info from Database? EST PHP 1 08-15-03 04:43 AM
how to get info from TXT file between %%customTags%% as vars?? paulj000 PHP 2 07-26-03 06:00 AM
Displaying images from MYSQL Soulidified PHP 1 07-22-03 07:01 PM
Displaying images! boskyvora PHP 4 06-30-03 08:53 AM


All times are GMT -5. The time now is 06:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.