MySQL Query

<?php echo "racer ID = " . $_GET["name"] . "<br>"; $host_name = "db581477570.db.1and1.com"; $database = "db581477570"; $user_name = "dbo581477570"; $password = "cxrCXRcxr321!!!"; // mysqli, object oriented way $connect = new mysqli($host_name, $user_name, $password, $database); if (mysqli_connect_error()) { echo "NOT Connected! " . mysqli_connect_error(); } else { echo "DB is connected!"; } $rID = $_GET['id']; $sql = "SELECT race.RaceID, racer.RacerID, RaceName, RaceDate, RaceCategoryName,result.RaceCategoryID, Place, FirstName, LastName, TeamName, RaceTime ,RacerCount, result.points, result.IsDNF, Gender, result.ResultID,result.TeamID,region.LongName,RaceLon,RaceLat,IsDQ FROM race INNER JOIN racecategory ON race.RaceID = racecategory.RaceID INNER JOIN result ON result.RaceCategoryID = racecategory.RaceCategoryID LEFT JOIN totalentriesview ON result.RaceCategoryID = totalentriesview.RaceCategoryID INNER JOIN racer ON result.RacerID = racer.RacerID INNER JOIN region ON race.Region = region.ID WHERE racer.RacerID = '$rID' ORDER BY RaceDate DESC"; $result = mysqli_query($connect,$sql); echo "<p>Results for " . "</p><table> <tr> <th>Race Name</th> <th>Place</th> <th>Time</th> <th>Category</th> <th>Date</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['RaceName'] . "</td>"; echo "<td>" . $row['Place'] . "</td>"; echo "<td>" . $row['RaceTime'] . "</td>"; echo "<td>" . $row['RaceCategoryName'] . "</td>"; echo "<td>" . date('M-d', strtotime($row['RaceDate'])) . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($connect); ?>
Part of an application I re-worked for a project

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.