<?php include("menu.php"); ?>
<?php include("dataaccess.php"); ?>
<?php include("functions.php"); ?>

<?php
//'   Copyright 2004 Vender-MGT  http://www.vender-mgt.com
if(!empty($HTTP_GET_VARS))
{   
if (!empty($HTTP_GET_VARS["orderby"]))
    $orderby = $HTTP_GET_VARS["orderby"];
if (!empty($HTTP_GET_VARS["order"]))        
    $order = $HTTP_GET_VARS["order"];
if (!empty($HTTP_GET_VARS["id"]))       
    $categoryid = $HTTP_GET_VARS["id"];
}


if(empty($orderby))
{
    $orderby = "projectname";
}
if(empty($order))
{
    $order = "asc";
}
if ($order == "asc") 
    $order = "desc";
else if ($order == "desc") 
    $order = "asc";
else
    $order = "asc";



dbConnect();
$result = mysql_query("Select * from cmt_project order by " . $orderby .  " " . $order . mysql_error());
?>

<h3 align="center">List Projects</h3>
<BR>
<em>Click on a column title to sort by that column; click again to reverse the sort.</em>
<?php
if (!$result) {
   die('Invalid query: ' . mysql_error());
}
    echo "<p><div align=center>";
    echo "<table width=650 cellspacing=1 cellpadding=5 border=0>";
    echo "<tr bgcolor=#6699CC><th font color=#FFFFFF nowrap><a href='listprojects.php?orderby=projectname&order=" . $order . "'>Project Name</a></th>
   <th colspan =3 ><font color=#FFFFFF size=2>P.I Name</a></th>
   <th colspan =3 ><font color=#FFFFFF size=2>Cordinator Name</a></th>
   <th ><font color=#FFFFFF size=2>Description</a></th>
   <th ><font color=#FFFFFF size=2>Start Date</a></th>
   <th ><font color=#FFFFFF size=2>End Date</a></th>
   <th ><font color=#FFFFFF size=2>Project Length</a></th>
   <th ><font color=#FFFFFF size=2>Period Left</font></th></tr>"; 

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $end = $row["enddate"];
    $ed=explode("-",$end);
    $edate=$ed[1]."-".$ed[2]."-".$ed[0];
   echo "<tr bgcolor=#C3A233><td nowarp><a href='showproject.php?id=" . $row["projectid"] ."'>" . $row["projectname"] . "</a></td>
   <td colspan = 3 nowrap>" . $row["pi_title"] . "." . $row["pi_fname"] . "." . $row["pi_lname"] . "</a></td>
   <td colspan =3 nowrap >" . $row["c_title"] . ". " . $row["c_fname"] . "." . $row["c_lname"] .  "</a></td>
   <td>" . $row["description"]  . "</a></td>
   <td>" . $row["startdate"] . "</a></td>
   <td>" . $row["enddate"] . "</a></td>
   <td>" . $row["length"] . "</a></td>
   <td>" .$timeleft = time_left($end)."</td></tr>";    
}
    echo "</table></div>";

mysql_free_result($result);

mysql_close();
?>

<br><br>
  <center>
<p><font color="#000000">Copyright © 2012 Joint Clinical Research Centre. All Rights Reserved </font>
  <?
  //This Software Copyright 2012 New Wave Contract Management.  See www.contract-mgt.com for details.
  //This Software is 100% Free and May not be redistributed.
  //or resold.
  ?>
</center>

Recommended Answers

All 4 Replies

Hi,

I think $HTTP_GET_VARS has been deprecated. Just use $_GET[].

The new implementation we are currently using in the last 2 years is this

if(($_SERVER["REQUEST_METHOD"] == "POST")|| ($_SERVER["REQUEST_METHOD"] == "GET")){

## deal with the GET method
function process_get(){

}
## deal with the POST method{

function process_post(){


}

}

By using the above processing method, you can pretty much process any form data coming from all points of your website.. Yes, that includes pagination. YOu will just have to write a simple function for it, or a simple processor class.

There are many closing </a> tags without the opening <a> tag in your table cells. Has this error happened during the copy/paste operations? On line 61 you have a typo <td nowarp> should be <td nowrap>.

Thanks veedeo....have coreected that, Thankz broj1 I had just copied and pasted line 61 for eac of those columms.
My issue is I need the timeleft to be displayed in cell ..line68 but it gets displayed on the right side top of my html table.....how can I fix this newbie (have a function time left that calculates time left from End date)... Thanx in advance

Member Avatar for diafol
"<td>" .$timeleft = time_left($end)."</td></tr>";

Maybe should be:

"<td>" . time_left($end)."</td></tr>"; 

If the function returns a value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.