Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- function unhide($id, $counter) {
- mysql_query("UPDATE tours SET Hide='0' WHERE Id = '" . $id . "' LIMIT 1");
- echo $counter . ". " . $id . "<br>\n";
- }
- if (isset($_GET['companyId']) && is_numeric($_GET['companyId'])) {
- $companyId = $_GET['companyId'];
- $query = "SELECT tours.Id, tours.Name FROM tours JOIN dates ON tours.Id = dates.TourId AND dates.StartDate > '2012-12-31' WHERE Hide = '1' AND tours.CompanyId = '" . $companyId . "' ORDER BY tours.Id";
- $result = mysql_query($query);
- $oldid = 0;
- $counter = 0;
- if (mysql_num_rows($result) > 0) {
- while ($row = mysql_fetch_array($result)) {
- if ($row['Id'] != $oldid) {
- $counter++;
- //echo $row['Id'] . "<br>\n";
- unhide($row['Id'], $counter);
- $oldid = $row['Id'];
- }
- }
- } else {
- echo "No tours found that meet criteria.";
- }
- } else {
- echo "we need a companyId.";
- exit();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement