scarface83 Posted April 25, 2007 Share Posted April 25, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/ Share on other sites More sharing options...
MadTechie Posted April 25, 2007 Share Posted April 25, 2007 change , to . on echo "date - ", $newdate," - ",$new_id; Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/#findComment-238047 Share on other sites More sharing options...
scarface83 Posted April 25, 2007 Author Share Posted April 25, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/#findComment-238061 Share on other sites More sharing options...
paul2463 Posted April 25, 2007 Share Posted April 25, 2007 you seem to be missing the following line of code $row2 = mysql_fetch_array($result2); Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/#findComment-238068 Share on other sites More sharing options...
MadTechie Posted April 25, 2007 Share Posted April 25, 2007 move $date_stamp =$row2['datestamp'] ; $new_id = $row2['ID']; into the whileloop Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/#findComment-238070 Share on other sites More sharing options...
paul2463 Posted April 25, 2007 Share Posted April 25, 2007 good one madtechie, I didnt see the while loop in the html code if you do what MadTechie says then the variables will be set where you are trying to set them there is nothing to set them to Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/#findComment-238073 Share on other sites More sharing options...
scarface83 Posted April 25, 2007 Author Share Posted April 25, 2007 that worked a treat thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/48615-solved-whats-wrong-with-this-code/#findComment-238107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.