no data outputted after login

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
ianhaney
New php-forum User
New php-forum User
Posts: 62
Joined: Tue May 01, 2012 12:30 pm

Fri May 18, 2018 7:31 am

I need some help with no data being outputted after logging in, I don't get any errors showing, it's just not showing any data for the specific user. My code is below

Code: Select all

<?php

ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);

$connect = mysqli_connect("localhost", "username", "password", "dbname");
 
 //entry.php  
 session_start();  
 if(!isset($_SESSION["username"]))  
 {  
      header("location:login.php?action=login");  
 }
 
  //define page title
$title = 'Repair Job/Status';

//include header template
require('layout/header.php'); 
   
 ?>  
 
 <!-- Content  -->
	<div id="page-content">
		<!-- Breadcrumbs Block -->
		<div class="block">
			<div class="container">
				<div class="breadcrumbs">
					<ul class="breadcrumb">
						<li><a href="/">Home</a></li>
						<li class="active">Repair Job/Status</li>
					</ul>
				</div>
			</div>
		</div>
		<!-- //Breadcrumbs Block -->
		<!-- Category Block -->
		<div class="block">
			<div class="container">
				<h1 class="text-center">Repair <span class="color">Job/Status</span></h1>

	    <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
 
                <?php

				
				$result = $connect->query("SELECT customer_ref FROM members WHERE username='{$_SESSION['username']}'");

				$ref = mysqli_fetch_assoc($result);
				
				foreach($connect->query("SELECT repairs.customer_ref, members.customer_ref, repairs.customer_name, repairs.customer_email, repairs.customer_phone, repairs.computer_make, repairs.computer_model, repairs.status, DATE_FORMAT(exrdate, '%d/%m/%Y') AS exrdate, repairs.exrtime, repairs.comments, repairs.job_cost				
FROM repairs
INNER JOIN members ON repairs.customer_ref=members.customer_ref WHERE id ='".$ref['customer_ref']."'") as $row) {
	
                echo "<p>"
				. 'Welcome ' . $row['customer_name'] . ', below is your repair job info and status';
				echo '<br><br>';
				echo '<strong>Your Customer Ref Number:</strong> ' . $row['customer_ref'];
				echo '<br>';
				echo '<strong>Name:</strong> ' . $row['customer_name'];
				echo '<br>';
				echo '<strong>Email:</strong> ' . $row['customer_email'];
				echo '<br>';
				echo '<strong>Phone Number:</strong> ' . $row['customer_phone'];
				echo '<br>';
				echo '<strong>Computer Make:</strong> ' . $row['computer_make'];
				echo '<br>';
				echo '<strong>Computer Model:</strong> ' . $row['computer_model'];
				echo '<br>';
				echo '<strong>Repair Status:</strong> ' . $row['status'];
				echo '<br>';
				echo '<strong>Expected Repair Date and Time:</strong> ' . $row['exrdate'] . ' estimated around ' . $row['exrtime'];
				echo '<br>';
				echo '<strong>Notes:</strong> ' . $row['comments'];
				echo '<br>';
				echo '<strong>Repair Cost:</strong> ' . '&#163;' . $row['job_cost'];
				echo "</p>";
                echo '<label><a href="logout.php">Logout</a></label>';
}
                ?>  
           </div>
           
           </div>
           </div>
           </div>

<?php 
//include footer template
require('layout/footer.php'); 
?>
Thank you in advance

Post Reply