annotate thule_fit_kits/index.php @ 70:3456dd3e8660

myrss: add exception handling around main()
author paulo
date Wed, 29 Jul 2015 00:20:39 -0600
parents a7ad7a5c899e
children 3afe26a1d000
rev   line source
paulo@0 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
paulo@0 2 <HTML>
paulo@0 3 <HEAD>
paulo@0 4 <META NAME="generator" CONTENT="http://txt2tags.sf.net">
paulo@0 5 <LINK REL="stylesheet" TYPE="text/css" HREF="index.css">
paulo@0 6 <TITLE>Thule Fit Kit Database</TITLE>
paulo@0 7 </HEAD>
paulo@0 8 <BODY>
paulo@0 9
paulo@0 10 <DIV CLASS="header" ID="header">
paulo@0 11 <H1>Thule Fit Kit Database</H1>
paulo@0 12 </DIV>
paulo@0 13
paulo@0 14 <DIV CLASS="body" ID="body">
paulo@0 15
paulo@0 16 <P>
paulo@0 17 Trying to figure out if you can reuse those Thule fit kit rubber pads or mounting brackets on another car? Here's a database you can check, with PDF installation instruction manuals.
paulo@0 18 </P>
paulo@0 19
paulo@22 20 <P>
paulo@24 21 NOTE: These fit kits fit the 400 and 800 series footpacks, but not the newer 480 footpacks.
paulo@22 22 </P>
paulo@22 23
paulo@0 24 <TABLE>
paulo@0 25 <TR>
paulo@0 26 <TH>Kit Number</TH>
paulo@0 27 <TH>Cars</TH>
paulo@0 28 <TH>Rubber Pad Number</TH>
paulo@0 29 <TH>Bracket Number</TH>
paulo@0 30 <TH>Miscellaneous Parts</TH>
paulo@0 31 </TR>
paulo@0 32
paulo@0 33 <?php
paulo@0 34
paulo@0 35 include('../../login.php');
paulo@0 36 $database = 'pauloang_fitkits';
paulo@0 37
paulo@0 38 $link = mysql_connect('localhost', $username, $password);
paulo@0 39 if (!$link)
paulo@0 40 die('Could not connect to MySQL server: ' . mysql_error());
paulo@0 41
paulo@0 42 $db_selected = mysql_select_db($database, $link);
paulo@0 43 if (!$db_selected)
paulo@0 44 die('Could not select database: ' . mysql_error());
paulo@0 45
paulo@0 46 $query = 'SELECT * FROM Thule ORDER BY kit_id';
paulo@0 47 $results = mysql_query($query);
paulo@0 48
paulo@0 49 while ($row = mysql_fetch_assoc($results)) {
paulo@4 50 echo '<TR><TD><DIV class="kit_id">';
paulo@3 51 $pdf_filename = 'pdf/thule-fit-kit-' . $row['kit_id']. '-instructions.pdf';
paulo@3 52 if (file_exists($pdf_filename))
paulo@3 53 echo '<A HREF="'. $pdf_filename . '">' . $row['kit_id'] . '</A>';
paulo@3 54 else
paulo@3 55 echo $row['kit_id'];
paulo@4 56 echo '</DIV></TD><TD>';
paulo@0 57 $cars = explode(';', $row['car']);
paulo@0 58 foreach ($cars as $car)
paulo@0 59 echo $car . '<br>';
paulo@0 60 echo '</TD>';
paulo@0 61 echo '<TD>' . $row['rubber_pad'] . '</TD>';
paulo@0 62 echo '<TD>' . $row['bracket'] . '</TD>';
paulo@0 63 echo '<TD>';
paulo@0 64 $misc = explode(',', $row['misc']);
paulo@0 65 foreach ($misc as $misc_item) {
paulo@0 66 if ($misc_item) {
paulo@0 67 $misc_item = trim($misc_item);
paulo@0 68 $misc_filename = 'misc_' . $misc_item . '.png';
paulo@0 69 if (file_exists($misc_filename))
paulo@0 70 echo '<IMG SRC="' . $misc_filename . '" ALT="' . $misc_item . '"> ';
paulo@0 71 else
paulo@0 72 echo $misc_item . ',';
paulo@0 73 }
paulo@0 74 }
paulo@0 75 echo '</TD>';
paulo@0 76 echo '</TR>' . "\n";
paulo@0 77 }
paulo@0 78
paulo@0 79 mysql_free_result($results);
paulo@0 80 mysql_close($link);
paulo@0 81
paulo@0 82 ?>
paulo@0 83
paulo@0 84 </TABLE>
paulo@0 85 </DIV>
paulo@0 86
paulo@0 87 <!-- html code generated by txt2tags 2.4 (http://txt2tags.sf.net) -->
paulo@0 88 <!-- cmdline: txt2tags index.t2t -->
paulo@0 89 </BODY></HTML>