[php]require_once(‘wordpress/wp-content/themes/deskmesschild/conn/pw_motorcycles.php’); $currentPage = $_SERVER[“PHP_SELF”]; $maxRows_log = 500; $pageNum_log = 0; if (isset($_GET[‘pageNum_log’])) { $pageNum_log = $_GET[‘pageNum_log’]; } $startRow_log = $pageNum_log * $maxRows_log; mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_log = “SELECT * FROM log ORDER BY log.log_date DESC”; $query_limit_log = sprintf(“%s LIMIT %d, %d”, $query_log, $startRow_log, $maxRows_log); $log = mysql_query($query_limit_log, $pw_motorcycles) or die(mysql_error()); if (isset($_GET[‘totalRows_log’])) { $totalRows_log = $_GET[‘totalRows_log’]; } else { $all_log = mysql_query($query_log); $totalRows_log = mysql_num_rows($all_log); } $totalPages_log = ceil($totalRows_log/$maxRows_log)-1; mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_spyder_RT = “SELECT bikename, odometer FROM log WHERE bikename = ‘can-am Spyder RT Limited’ ORDER BY log.log_date DESC”; $mileage_spyder_RT = mysql_query($query_mileage_spyder_RT, $pw_motorcycles) or die(mysql_error()); $row_spyder_RT = mysql_fetch_assoc($mileage_spyder_RT); $totalRows_spyder_RT = mysql_num_rows($mileage_spyder_RT); $query_mileage_honda_90 = “SELECT bikename, odometer FROM log WHERE bikename = ‘Honda 90’ ORDER BY log.log_date DESC”; $mileage_honda_90 = mysql_query($query_mileage_honda_90, $pw_motorcycles) or die(mysql_error()); $row_honda_90 = mysql_fetch_assoc($mileage_honda_90); $totalRows_honda_90 = mysql_num_rows($mileage_honda_90); $query_mileage_honda_160= “SELECT bikename, odometer FROM log WHERE bikename = ‘Honda 160’ ORDER BY log.log_date DESC”; $mileage_honda_160 = mysql_query($query_mileage_honda_160, $pw_motorcycles) or die(mysql_error()); $row_honda_160 = mysql_fetch_assoc($mileage_honda_160); $totalRows_honda_160 = mysql_num_rows($mileage_honda_160); $query_mileage_trike = “SELECT bikename, odometer FROM log WHERE bikename = ‘Trike’ ORDER BY log.log_date DESC”; $mileage_trike = mysql_query($query_mileage_trike, $pw_motorcycles) or die(mysql_error()); $row_mileage_trike = mysql_fetch_assoc($mileage_trike); $totalRows_mileage_trike = mysql_num_rows($mileage_trike); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_fatboy = “SELECT bikename, odometer FROM log WHERE bikename = ‘Fatboy’ ORDER BY log.log_date DESC”; $mileage_fatboy = mysql_query($query_mileage_fatboy, $pw_motorcycles) or die(mysql_error()); $row_mileage_fatboy = mysql_fetch_assoc($mileage_fatboy); $totalRows_mileage_fatboy = mysql_num_rows($mileage_fatboy); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_sportster = “SELECT bikename, odometer FROM log WHERE bikename = ‘Sportster’ ORDER BY log.log_date DESC”; $mileage_sportster = mysql_query($query_mileage_sportster, $pw_motorcycles) or die(mysql_error()); $row_mileage_sportster = mysql_fetch_assoc($mileage_sportster); $totalRows_mileage_sportster = mysql_num_rows($mileage_sportster); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_prairie = “SELECT bikename, odometer FROM log WHERE bikename = ‘Prairie’ ORDER BY log.log_date DESC”; $mileage_prairie = mysql_query($query_mileage_prairie, $pw_motorcycles) or die(mysql_error()); $row_mileage_prairie = mysql_fetch_assoc($mileage_prairie); $totalRows_mileage_prairie = mysql_num_rows($mileage_prairie); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_bayou = “SELECT bikename, odometer FROM log WHERE bikename = ‘Bayou’ ORDER BY log.log_date DESC”; $mileage_bayou = mysql_query($query_mileage_bayou, $pw_motorcycles) or die(mysql_error()); $row_mileage_bayou = mysql_fetch_assoc($mileage_bayou); $totalRows_mileage_bayou = mysql_num_rows($mileage_bayou); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_trail_bike = “SELECT bikename, odometer FROM log WHERE bikename = ‘Trail bike’ ORDER BY log.log_date DESC”; $mileage_trail_bike = mysql_query($query_mileage_trail_bike, $pw_motorcycles) or die(mysql_error()); $row_mileage_trail_bike = mysql_fetch_assoc($mileage_trail_bike); $totalRows_mileage_trail_bike = mysql_num_rows($mileage_trail_bike); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_dresser = “SELECT bikename, odometer FROM log WHERE bikename = ‘Dresser’ ORDER BY log_date DESC”; $mileage_dresser = mysql_query($query_mileage_dresser, $pw_motorcycles) or die(mysql_error()); $row_mileage_dresser = mysql_fetch_assoc($mileage_dresser); $totalRows_mileage_dresser = mysql_num_rows($mileage_dresser); mysql_select_db($database_pw_motorcycles, $pw_motorcycles); $query_mileage_dyna = “SELECT bikename, odometer FROM log WHERE bikename = ‘Dyna WideGlide’ ORDER BY log_date DESC”; $mileage_dyna = mysql_query($query_mileage_dyna, $pw_motorcycles) or die(mysql_error()); $row_mileage_dyna = mysql_fetch_assoc($mileage_dyna); $totalRows_mileage_dyna = mysql_num_rows($mileage_dyna); [/php]
I don’t record every motorcycle ride but hopefully some of the more interesting ones. The list of bikes is here. Cumulative miles ridden on the bikes is below followed by the log of activity.
Motorcycle Mileage Summary
Current Motorcycles
[php] echo $row_mileage_bayou[‘bikename’]; [/php]: [php] echo number_format($row_mileage_bayou[‘odometer’],0,’.’,’,’); [/php]
[php] echo $row_spyder_RT[‘bikename’]; [/php]: [php] echo number_format($row_spyder_RT[‘odometer’],0,’.’,’,’); [/php]
[php] echo $row_mileage_fatboy[‘bikename’]; [/php]: [php] echo number_format($row_mileage_fatboy[‘odometer’],0,’.’,’,’); [/php]
[php] echo $row_mileage_prairie[‘bikename’]; [/php]: [php] echo number_format($row_mileage_prairie[‘odometer’],0,’.’,’,’); [/php]
[php] echo $row_mileage_trail_bike[‘bikename’]; [/php]: [php] echo number_format($row_mileage_trail_bike[‘odometer’],0,’.’,’,’); [/php]
Previous Motorcycles
[php] echo $row_mileage_dresser[‘bikename’]; [/php]: [php] echo number_format($row_mileage_dresser[‘odometer’],0,’.’,’,’); [/php]
[php] echo $row_mileage_dyna[‘bikename’]; [/php]: [php] echo number_format($row_mileage_dyna[‘odometer’],0,’.’,’,’); [/php]
[php] echo $row_mileage_sportster[‘bikename’]; [/php]: [php] echo number_format($row_mileage_sportster[‘odometer’],0,’.’,’,’);[/php]
[php] echo $row_mileage_trike[‘bikename’]; [/php]: [php] echo number_format($row_mileage_trike[‘odometer’],0,’.’,’,’); [/php]
[php] if($row_honda_90[‘odometer’] != 0) { [/php]
[php] echo $row_honda_90[‘bikename’]; [/php]: [php] echo number_format($row_honda_90[‘odometer’],0,’.’,’,’); [/php] [php] } if($row_honda_160[‘odometer’] != 0) { [/php]
[php] echo $row_honda_160[‘bikename’]; [/php]: [php] echo number_format($row_honda_160[‘odometer’],0,’.’,’,’); [/php] [php] } [/php]
Total Mileage – all bikes: [php] echo number_format($row_mileage_trike[‘odometer’]+$row_mileage_fatboy[‘odometer’]+$row_mileage_bayou[‘odometer’] +$row_spyder_RT[‘odometer’]+$row_mileage_prairie[‘odometer’]+$row_mileage_trail_bike[‘odometer’]+$row_mileage_sportster[‘odometer’] +$row_mileage_dresser[‘odometer’]+$row_mileage_dyna[‘odometer’]+$row_honda_90[‘odometer’]+$row_honda_160[‘odometer’],0,’.’,’,’); [/php]
Motorcycle Activity Log
[php] while($row_log = mysql_fetch_assoc($log)){ [/php]
[php]echo date(‘l, F d, Y’,strtotime($row_log[‘log_date’])); echo $row_log[‘bikename’];[/php]
Activity: [php] echo $row_log[‘activity_type’]; [/php] – [php] echo $row_log[‘activity’]; [/php]
Miles: [php] echo $row_log[‘miles’]; [/php]
Odometer: [php] echo number_format($row_log[‘odometer’],0,’.’,’,’); [/php]
Weather: [php] echo $row_log[‘weather’]; [/php] and [php] echo $row_log[‘temperature’]; [/php] degrees
Notes: [php] echo $row_log[‘notes’]; [/php]
[php] } [/php]
End of List (there are no more entries!).