Jump to content

Help to developer a free progress tour table


ARV187

Recommended Posts

Hi all, im trying make a progress tour table. My actual table is showing the results in vertical with this scheme:

pilotid-nºflight-accepted

arv187-f1-1

arv187-f2-1

arv187-f3-1

arv220-f1-1

arv220-f2-1

arv220-f3-1

You can see a example here: http://argavirtual.b...la de tours.php

This is a bad table then i want show results in horizontal mode, as seen in the example image:

post-5667-0-01321800-1386465429_thumb.jpg

But not work well, you can see in the first table (vertical table) that pilot id "307" only have complete the first flight "Ruta1"(HAW1), but in the image attachet he have put a "accepted=1" in "Ruta2"(HAW2). This point exceeds my knowledge and im blocked.

This is the code:

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
 break;
case "long":
case "int":
 $theValue = ($theValue != "") ? intval($theValue) : "NULL";
 break;
case "double":
 $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
 break;
case "date":
 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
 break;
case "defined":
 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
 break;
}
return $theValue;
}
}
mysql_select_db($database_byethost, $byethost);
$query_Ruta1 = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='HAW1' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC LIMIT 0 , 300";
$Ruta1 = mysql_query($query_Ruta1, $byethost) or die(mysql_error());
$row_Ruta1 = mysql_fetch_assoc($Ruta1);
$totalRows_Ruta1 = mysql_num_rows($Ruta1);
mysql_select_db($database_byethost, $byethost);
$query_Ruta2 = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='HAW2' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC LIMIT 0 , 300";
$Ruta2 = mysql_query($query_Ruta2, $byethost) or die(mysql_error());
$row_Ruta2 = mysql_fetch_assoc($Ruta2);
$totalRows_Ruta2 = mysql_num_rows($Ruta2);
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table border="5" cellpadding="2" cellspacing="2">
<tr>
<td>pilotid</td>
<td>Ruta1</td>
<td>Ruta2</td>
<td>Ruta3</td>
<td>Ruta4</td>
<td>Ruta5</td>
<td>Ruta6</td>
<td>Ruta7</td>
<td>Ruta8</td>
<td>Ruta9</td>
</tr>
<?php do { ?>
<tr>
 <td><?php echo $row_Ruta1['pilotid']; ?></td>
 <td><?php echo $row_Ruta1['accepted']; ?></td>
 <td><?php echo $row_Ruta2['accepted']; ?></td>
 <td> </td>
 <td> </td>
 <td> </td>
 <td> </td>
 <td> </td>
 <td> </td>
 <td> </td>
</tr>
<?php } while ($row_Ruta1 = mysql_fetch_assoc($Ruta1)); ?>

</table>
</body>
</html>
<?php
mysql_free_result($Ruta1);
mysql_free_result($Ruta2);
?>

  • Like 1
Link to comment
Share on other sites

  • Members

Most propably because your code it a litle bit complicated

I have a couple of questions

1. Did you wrote the code or did you find it somewhere ? (I am asking this because i think some code is missing)

2. 1 query on each table, also nowhere in your mysql queries you croscheck if the pilot has done the flight you just ask to display

and that is why you have false information showing up

Link to comment
Share on other sites

Hi Vangelis,

1.- the initial code is made with macromedia dreamweaver.

mysql_select_db($database_byethost, $byethost);

$query_Ruta1 = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='HAW1' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC LIMIT 0 , 300";

$Ruta1 = mysql_query($query_Ruta1, $byethost) or die(mysql_error());

$row_Ruta1 = mysql_fetch_assoc($Ruta1);

$totalRows_Ruta1 = mysql_num_rows($Ruta1);

the rest I am trying to do it by myself But not is finished because $ruta2 not work, (pilot 307).

2- That part is because im very novice in php & mysql. Only know make request to show the data.

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

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