All pastes #563881 Raw Edit

Mine

public php v1 · immutable
·published 2007-06-13 10:39 UTC
rendered paste body
if (isset($_POST['submit'])) {	$sql = "SELECT m.nrint as NrInt, m.nrmatricol as NrMatricol, v.data as Data, p.denumire as Plecare, s.denumire as Sosire, t.tarif AS Tarif, c.denumire AS Client "		."FROM masini m, viaggi v, plecare p, sosire s, tarife t, clienti c "		."WHERE m.id = v.idauto "		."AND p.id = v.idplecare "		."AND s.id = v.idsosire "		//			."AND t.idplecare  = p.id "		//			."AND t.idsosire = s.id "		."AND t.id = v.idtarif "		."AND c.id = t.idclient ";	if (isset($_POST['datefrom']) && $_POST['datefrom'] != '') $sql .= "AND v.data >= '". date2sql($_POST['datefrom']) ."' ";	if (isset($_POST['dateto']) && $_POST['dateto'] != '') $sql .= "AND v.data <= '". date2sql($_POST['dateto']) ."' ";	if (isset($_POST['auto']) && $_POST['auto'] != '') $sql .= "AND v.idauto = '". $_POST['auto'] ."' "; 	$res = mysql_query($sql, $link) or die (mysql_error());	//		echo $sql;	if (mysql_num_rows($res) >= 1 ) {		echo "<table align=center><tr><td>";		echo "<table align=center><tr><td>\n";		$total = 0;		while ($r = mysql_fetch_array($res)) {			echo "<tr>";			echo "<td align=center width=150>". $r['NrInt'] ." - ". $r['NrMatricol'] ."</td>"				."<td align=center width=150>". $r['Client'] ."</td>"				."<td align=center width=100>". sql2date($r['Data']) ."</td>"				."<td align=center width=150>". $r['Plecare'] ."</td>"				."<td align=center width=150>". $r['Sosire']	."</td>"				."<td align=center width=100>". $r['Tarif'] ." &euro;</td>"				."</tr>\n";			$total += $r['Tarif'];		}		@mysql_free_result($res);		echo "<tr><td colspan=5 align=right><b>TOTALE:</b></td><td align=center><b>$total &euro;</b></td></tr>";		echo "</table>";		echo "</td></tr></table>";	}}