Jump to content

[SOLVED] whats wrong with this code ?


scarface83

Recommended Posts

Hi, for some reason when i echo the $new_id and $new_date it shows no data but if i was to use $row2['datestamp'] or $row2['ID'] is works ?

 

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

	$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"> Pending Absence for your Team </div>
<div class="subtitle"> Please Confirm whether this absence should save to your absence calendar ? </div>

<div class="pend_absence"><?php while ($row2 = mysql_fetch_array($result2)){
	echo "date - ", $newdate," - ",$new_id;
	}
?>		
</div>

Link to comment
https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/
Share on other sites

changed to

echo "date - ". $newdate." - ".$new_id;

<br>

still no difference if i try to echo $newdate or $new_id early on in the script it still shows no results seems like this bit isn't working

$date_stamp =$row2['datestamp'] ;

	$new_id	=	$row2['ID'];

 

thanks

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.