view thule_fit_kits/index.php @ 3:f6be2a5839f0

thule_fit_kits/index.php: check if pdf exists to see whether to make hyperlink or not
author paulo@twcdns.fastsearch.net
date Mon, 23 Aug 2010 22:53:43 -0700
parents 561c0b0f3234
children bc72be51af82
line source
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <HTML>
3 <HEAD>
4 <META NAME="generator" CONTENT="http://txt2tags.sf.net">
5 <LINK REL="stylesheet" TYPE="text/css" HREF="index.css">
6 <TITLE>Thule Fit Kit Database</TITLE>
7 </HEAD>
8 <BODY>
10 <DIV CLASS="header" ID="header">
11 <H1>Thule Fit Kit Database</H1>
12 </DIV>
14 <DIV CLASS="body" ID="body">
16 <P>
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.
18 </P>
20 <TABLE>
21 <TR>
22 <TH>Kit Number</TH>
23 <TH>Cars</TH>
24 <TH>Rubber Pad Number</TH>
25 <TH>Bracket Number</TH>
26 <TH>Miscellaneous Parts</TH>
27 </TR>
29 <?php
31 include('../../login.php');
32 $database = 'pauloang_fitkits';
34 $link = mysql_connect('localhost', $username, $password);
35 if (!$link)
36 die('Could not connect to MySQL server: ' . mysql_error());
38 $db_selected = mysql_select_db($database, $link);
39 if (!$db_selected)
40 die('Could not select database: ' . mysql_error());
42 $query = 'SELECT * FROM Thule ORDER BY kit_id';
43 $results = mysql_query($query);
45 while ($row = mysql_fetch_assoc($results)) {
46 echo '<TR><TD>';
47 $pdf_filename = 'pdf/thule-fit-kit-' . $row['kit_id']. '-instructions.pdf';
48 if (file_exists($pdf_filename))
49 echo '<A HREF="'. $pdf_filename . '">' . $row['kit_id'] . '</A>';
50 else
51 echo $row['kit_id'];
52 echo '</TD><TD>';
53 $cars = explode(';', $row['car']);
54 foreach ($cars as $car)
55 echo $car . '<br>';
56 echo '</TD>';
57 echo '<TD>' . $row['rubber_pad'] . '</TD>';
58 echo '<TD>' . $row['bracket'] . '</TD>';
59 echo '<TD>';
60 $misc = explode(',', $row['misc']);
61 foreach ($misc as $misc_item) {
62 if ($misc_item) {
63 $misc_item = trim($misc_item);
64 $misc_filename = 'misc_' . $misc_item . '.png';
65 if (file_exists($misc_filename))
66 echo '<IMG SRC="' . $misc_filename . '" ALT="' . $misc_item . '"> ';
67 else
68 echo $misc_item . ',';
69 }
70 }
71 echo '</TD>';
72 echo '</TR>' . "\n";
73 }
75 mysql_free_result($results);
76 mysql_close($link);
78 ?>
80 </TABLE>
81 </DIV>
83 <!-- html code generated by txt2tags 2.4 (http://txt2tags.sf.net) -->
84 <!-- cmdline: txt2tags index.t2t -->
85 </BODY></HTML>