Jump to content

zeros id BZS012


M-Queiroz

Recommended Posts

en

Nabeel I'm struggling to get the id of the pilot with this query?

<?php
//set local variables
$dbhost = "localhost"; 
$dbuser = "xxxxxx"; 
$dbpass = "xxxxxx"; 
$dbname = "xxxxxx"; 


//connect 
$db = mysql_pconnect($dbhost,$dbuser,$dbpass); 
mysql_select_db("$dbname",$db); 

// tex de MySQL Connection

echo "<br />";

//base de dados 

echo "<br />";

//base de dados 

// Total pilotos que mais voou no mes por horas
$query = "select p.code, p.pilotid, firstname, lastname, sum(r.flighttime) ,count(r.pirepid), submitdate, r.pilotid
from phpvms_pilots p left join phpvms_pireps r on p.pilotid = r.pilotid right join phpvms_aircraft a on a.id = r.aircraft
WHERE year(r.submitdate) = year(now()) and month(r.submitdate) = month(now())
GROUP BY p.pilotid
ORDER BY sum(r.flighttime) DESC 
LIMIT 0,10";
            
$result = mysql_query($query) or die(mysql_error());
// Print out result

while($row = mysql_fetch_array($result)){
   echo "Piloto: ". $row['firstname']. " ". $row['lastname'];
   echo "<br />";
        echo " ID:  ". $row['code']. "0". $row['pilotid'];
   echo "<br />";
   echo "Total de Voos: ". $row['count(r.pirepid)'];
   echo "<br />";
   echo "Horas:  " . $row['sum(r.flighttime)'] ;
   echo "<br />";
   echo "<br />";
}

?>

wanted to show the picture of the driver but is missing the zeros id BZS012 but would have to be as BZS0012 could do this work.

BR

Nabeel estou quebrando a cabeça para pegar o id do piloto com esta consulta ?

queria mostrar a foto do piloto mas fica faltando os zeros do id BZS012 mas teria que ser BZS0012 como poderia fazer este funcionar.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...