Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- | book_no | name | dob | mobile_no |
- |---------|-----------|------------|------------|
- | 1 | ABCD | 1995-08-01 | 123456789 |
- | 2 | EFGH | 2016-08-01 | 123456789 |
- | 3 | HIKJ | 2016-05-01 | 123456789 |
- | 4 | LMNO | 2016-08-01 | 123456789 |
- | 5 | PQRS | 1995-08-01 | 123456789 |
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "gold";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn)
- {
- die("Connection failed: " . mysqli_connect_error());
- }
- $sql1 = "SHOW TABLES";
- $result1 = mysqli_query($conn,$sql1);
- if(!$result1)
- {
- echo "Error fetching data from tempTable: " . mysqli_error($conn);
- }
- else
- {
- while ($row1 = $result1->fetch_assoc())
- {
- foreach($row1 as $key1 => $var1)
- {
- $sql2 = "SELECT name,mobile_no FROM " .$var1. " WHERE dob = CURDATE()";
- $result2 = mysqli_query($conn,$sql2);
- $bBoy = array();
- if(!$result2)
- {
- echo "Error fetching data from tempTable: " . mysqli_error($conn);
- }
- else
- {
- while ($row2 = $result2->fetch_assoc())
- {
- echo $row2['name']."<br>";
- echo $row2['mobile_no']."<br>";
- }
- }
- }
- }
- }
- >?
- EFGH
- 123456789
- LMNO
- 123456789
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement