Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username="user";
- $password="pass";
- $database="DB";
- mysql_connect(localhost,$username,$password);
- mysql_select_db($database) or die( "Unable to select database");
- $query="SELECT id, firstname, lastname, town, age, date FROM signin GROUP BY firstname, lastname WHERE Date =< now() - INTERVAL 30 DAY";
- $result=mysql_query($query);
- $num=mysql_numrows($result);
- mysql_close();
- ?>
- <table border="1" cellspacing="2" cellpadding="2">
- <tr>
- <td>ID</font></td>
- <td>FirstName</td>
- <td>LastName</td>
- <td>Town</td>
- <td>Age</td>
- <td>Date</td>
- </tr>
- <?php
- $i=0;
- while ($i < $num) {
- $f1=mysql_result($result,$i,"firstname");
- $f2=mysql_result($result,$i,"lastname");
- $f3=mysql_result($result,$i,"town");
- $f4=mysql_result($result,$i,"age");
- $f5=mysql_result($result,$i,"date");
- ?>
- <?php if (lessThanOneMonthFromNow($f5)){ ?>
- <tr>
- <td><a href="<?php echo "submit.php?FName=".$f1."&LName=".$f2."&Town=".$f3."&Age=".$f4 ?>">Signin</a></td>
- <td><?php echo $f1; ?></td>
- <td><?php echo $f2; ?></td>
- <td><?php echo $f3; ?></td>
- <td><?php echo $f4; ?></td>
- <td><?php echo $f5; ?></td>
- </tr>
- <?php
- }
- $i++;
- }
- function lessThanOneMonthFromNow($enteredDate){
- return $enteredDate < date("Ymd", mktime(0, 0, 0, date("m")-1, date("d"), date("y")));
- }
- ?>
Add Comment
Please, Sign In to add comment