Jump to content

Only Displaying One Result Please Help


jigsawsoul

Recommended Posts

I have two rows within my database and all the information is being put in to the database right, but when i try to display this information with the below code, i only see the latest entry, but it displays right, i just need it to display all the rows within the database not just the one. I can't see the problem, can you guys help ?

 

<?php

session_start();

include '../../library/opendb.php';
include '../../library/config.php';
include '../../library/functions/f_login.php';
include '../../library/functions/f_nav.php';

sessionAuthenticate( );

$message .= $_SESSION["message"];

$username = $_SESSION["username"];

$result = "SELECT * FROM wbl_login WHERE username = '$username'";
$result = mysql_query ($result) or die (mysql_error());
$row = mysql_fetch_assoc ($result);

$username = $row['username'];
$username = ucwords($username);

// Current page.
$page = "commissionresponses";

// Get all member's information
$result = 	"SELECT * FROM wbl_commissionrespond
				LEFT JOIN wbl_commission ON wbl_commissionrespond.commission_id=wbl_commission.commission_id
				LEFT JOIN wbl_login ON wbl_commissionrespond.login_id=wbl_login.login_id
				LEFT JOIN wbl_customers ON wbl_login.customer_id=wbl_customers.customer_id
				ORDER BY commissionrespond_id DESC";

$result = mysql_query ($result) or die (mysql_error());
while($row = mysql_fetch_assoc($result)) 
{

	$person1 = $row['craftsperson1_id'];
	$query = "SELECT * FROM wbl_craftsperson WHERE craftsperson_id = $person1";
		$result = mysql_query ($query) or die (mysql_error());
		$row1 = mysql_fetch_assoc ($result);
			$craftsperson1 = $row1['name'];

	$person2 = $row['craftsperson2_id'];
	$query2 = "SELECT * FROM wbl_craftsperson WHERE craftsperson_id = $person2";
		$result2 = mysql_query ($query2) or die (mysql_error());
		$row2 = mysql_fetch_assoc ($result2);
			$craftsperson2 = $row2['name'];


	 switch ($row['status']) {
	 	case "pending":
	 	$links = '<a href = "details.php?id='.$row['commissionrespond_id'].'" >Read More</a> | <a href = "respond.php?id='.$row['commissionrespond_id'].'" >Respond</a> | 
						<a href = "update.php?id='.$row['commissionrespond_id'].'" >Edit</a> | <a href = "delete.php?id='.$row['commissionrespond_id'].'" >Delete</a>';
	 	break;
	 	case "complete";
	 	$links = '<a href = "details.php?id='.$row['commissionrespond_id'].'" >Read More</a> | <a href = "delete.php?id='.$row['commissionrespond_id'].'" >Delete</a>';
	 	break;
	 }

	$tablerows .= '
		<tr class="alt">
			<td>'.$row['commission_id'].'</td>
			<td>'.$row['username'].'</td>
			<td>'.$craftsperson1.'</td>
			<td>'.$row['quote1'].'</td>
			<td>'.$craftsperson2.'</td>
			<td>'.$row['quote2'].'</td>
			<td>'.$row['status'].'</td>
			<td>'.$links.'</td>
		</tr>
	';		
 }

?>

<?php include ('../../library/template/admin/htmlstart.php'); ?>

<div id="wrap" class="clearfix">

	<?php include ('../../library/template/admin/adminpanel.php'); ?>
    
    <div id="content" class="clearfix">
    	    	
		<?php mainNav($page); ?>

    	<div id="left" class="clearfix">
    		<div id="left_container">
    			
				<?php subNav($page); ?>

				<?=$message?>

				<h1 class="section">Current Enquiry Responses</h1>
    					
    			<table id="project_members">
				    <tr>
				    	<th>Commission Ref:</th>
				    	<th>Staff Member:</th>
				    	<th>Crafts Person:</th>
						<th>Quote:</th>
						<th>Crafts Person:</th>
				    	<th>Quote:</th>
				    	<th>Status:</th>
				    	<th>Operations:</th>
				    </tr>
				    	
				    <?=$tablerows?>
				    	
				</table>	

    		</div>
    	</div>
    	<!-- Right Side Bar Here -->	    	
		<?php include ('../../library/template/admin/footer.php'); ?>
</body>
</html>

<?php

unset ($_SESSION["message"]);

include '../../library/closedb.php'; 

?>

Link to comment
https://forums.phpfreaks.com/topic/170461-only-displaying-one-result-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.