Jump to content

while loop not working


scarface83

Recommended Posts

<?php
	session_start();


	include ('db_connect.inc');

	$query = " SELECT TeamRef FROM a_users WHERE Login='$keepit'  ";
	$result = mysql_query($query) or die (mysql_error); // runs the above query
	$row = mysql_fetch_array($result);
	$tm = $row['TeamRef'] ;

	$query2 = "SELECT datestamp, ID FROM absence_mgt WHERE viewable='1' AND TeamRef='$tm'"; 

	$result2 = mysql_query($query2) or die (mysql_error); // runs the above query
	$row2 = mysql_fetch_assoc($result2);
	$date_stamp =$row2['datestamp'] ;

	$new_id	=	$row2['ID'];

	list($year,$month,$day) = split("-",$date_stamp);
	$newdate = $day."/".$month."/".$year;


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="/ab_mgt/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="title"> <u><b>Pending Absence for your Team</b></u> </div>
<div class="pend_subtitle"> Please Confirm if this absence should be saved to your absence calendar ? </div>
<div class="back"><a href="main.php">Back</a></div>

<div class="pend_absence">

<?php 
	$query3 = mysql_query("SELECT Forename,Surname FROM a_users WHERE In_use='Y' AND Login='$new_id'")or die (mysql_error);

	$row3 = mysql_fetch_assoc($query3);
	session_unregister('first');
	session_unregister('second');
	$first = $row3['Forename'];
	$second = $row3['Surname'];



	while ($row2 = mysql_fetch_assoc($result2)){
	echo "Date of Absence - ". $newdate." - ".$new_id." - ". $first." ".$second."   <a href= 'test' >Save</a>";

}
?>		
</div>

<?php mysql_close();
?>
</body>
</html>

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.