Difference between revisions of "PHP:Clientupdates body"

From distributed.net
Jump to navigationJump to search
 
Line 2: Line 2:
  
 
global $dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName;
 
global $dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName;
$db = mysql_pconnect($dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword);
+
$db = new mysqli($dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName);
mysql_select_db($dnetClientsDBName,$db);
 
  
$result = mysql_query("select S.ranking, S.description as s_description, C.releasedate, C.build, C.description as c_description, C.urlpart, C.instruct, S.sectionid from sections S, clients C where C.sectionid=S.sectionid and C.visible='true' order by C.releasedate Desc, S.ranking Desc, S.description, C.build",$db);
+
$result = $db->query("select S.ranking, S.description as s_description, C.releasedate, C.build, C.description as c_description, C.urlpart, C.instruct, S.sectionid from sections S, clients C where C.sectionid=S.sectionid and C.visible='true' order by C.releasedate Desc, S.ranking Desc, S.description, C.build");
  
  
Line 12: Line 11:
 
print "<table>";
 
print "<table>";
  
while ($clientrow = mysql_fetch_array($result))
+
while ($clientrow = $result->fetch_array())
 
{
 
{
 
     if ($clientrow['releasedate'] != $lastsection) {
 
     if ($clientrow['releasedate'] != $lastsection) {
Line 25: Line 24:
 
       , $clientrow['s_description'], $clientrow['c_description'], $clientrow['build'] );
 
       , $clientrow['s_description'], $clientrow['c_description'], $clientrow['build'] );
 
}
 
}
 +
$result->free();
 +
$db->close();
  
 
print "</table>";
 
print "</table>";
  
 
// </pre>
 
// </pre>

Latest revision as of 22:24, 4 February 2020

//


global $dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName;
$db = new mysqli($dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName);

$result = $db->query("select S.ranking, S.description as s_description, C.releasedate, C.build, C.description as c_description, C.urlpart, C.instruct, S.sectionid from sections S, clients C where C.sectionid=S.sectionid and C.visible='true' order by C.releasedate Desc, S.ranking Desc, S.description, C.build");


$lastsection = "";

print "<table>";

while ($clientrow = $result->fetch_array())
{
    if ($clientrow['releasedate'] != $lastsection) {
         printf('<tr><td colspan="4"><b>%s</b></td></tr>', $clientrow['releasedate']);
         $lastsection = $clientrow['releasedate'];
     }

     printf("<tr><td> </td>" .
          "<td>%s %s </td>" .
          '<td nowrap="nowrap" align="right"><b>%s</b></td>' .
          "</tr>"
      , $clientrow['s_description'], $clientrow['c_description'], $clientrow['build'] );
}
$result->free();
$db->close();

print "</table>";

//