Advertisement
SouldrinK

Untitled

Oct 29th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2. include("config.php");
  3.  
  4. $query = "SELECT tours.Id, tours.Name FROM tours JOIN dates ON tours.Id = dates.TourId AND dates.StartDate > '2012-12-31' WHERE Hide = '1' ORDER BY tours.Id";
  5. $result = mysql_query($query);
  6.  
  7. $oldid = 0;
  8. $counter = 0;
  9.  
  10. while ($row = mysql_fetch_array($result)) {
  11.     if ($row['Id'] != $oldid) {
  12.         $counter++;
  13.         echo $row['Id'] . "<br>\n";
  14.         unhide($row['Id'], $counter);
  15.         $oldid = $row['Id'];
  16.     }
  17. }
  18.  
  19. function unhide($id) {
  20.     mysql_query("UPDATE tours SET Hide='0' WHERE Id = '" . $id . "' LIMIT 1");
  21.     echo $counter . ". " . $id . "<br>\n";
  22. }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement