Sunday, 4 March 2018

PHP Code | Add Parent On Array | Parent Child JSON Array Using PHP


code in php to add parent Element on array
<?php
$array1=array();
for($i=1;$i<=10;$i++)
{
    array_push($array1,['id'=>$i]);
}
$array2->numbers=$array1;
echo $final_output= json_encode($array2);
?>

Tuesday, 13 February 2018

Include Other Web Pages On Button Click | Dynamic Page Using JavaScript And HTML | WAMP


Source Code:- Home_Page.php 


<center><h1 style="background-color: darkgreen"><font color="yellow">Dynamic Page</font></h1></center>
<table border="1" height="100%" width="100%">
    <tr>
        <th width="20%" onclick="document.getElementById('dynamic').innerHTML='<iframe src=Pagignation.php width=100% height=100%></iframe>';     ">
         First Page  
        </th>
        <th rowspan="4" id="dynamic">
        
        </th>
    </tr>
    <tr height="85%">
        <th>
           
        </th>
    </tr>
</table>

Sunday, 11 February 2018

Sunday, 4 February 2018

PHP Tutorial | Easiest Way To Add Pagination On Web Site | Using php, phpmyadmin, Javascript

Watch video and you follow my steps to perform pegination on web site..

Source code :-

<html>
    <head>
        
       
    </head>
<body>
    <?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "tutorial";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

$sql = "SELECT * FROM employees";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
        {
            echo "id: " . $row["id"]. " - Name: " . $row["name"]."<br/>";
        }
?>
        <button onclick="getElementById('page').innerHTML='Dynamic Display'">Click here</button>
      
    <div id="page"></div>
</body>

Friday, 2 February 2018

PHP Tutorial : Find Upcoming Date From Database | WAMP | LAMP | phpmyadmin



Source Code :- Next_day.php
<?php
//$name=$_POST["name"];
$con=new mysqli("localhost","root","","test");
$result=$con->query("select * from dates order by date ASC");
$year=date("Y");
while($row = $result->fetch_assoc()) {
       // echo "Date:" . $row["date"]." Day :". $row["name"]."<br/>";
        if($year==  substr($row['date'], 0, 4))
        {
           
            if((int)substr($row['date'], 5, 6)==(int)date("m"))
            {
                if((int)substr($row['date'], 8, 9)>(int)date("d"))
                {
                    echo "Upcoming Date:" . $row["date"]." <br/>Upcoming Day :". $row["name"]."";
                    break;
                }
            }
            else if((int)substr($row['date'], 5, 6)>(int)date("m"))
            {
                echo "Upcoming Date:" . $row["date"]." <br/>Upcoming Day :". $row["name"]."";
                break;
            }
        }
    }
?>

Sunday, 28 January 2018

PHP Tutorial : Include Page On Button Click Without Refreshing Main Page | Dynamic Page Loading

Remember that this technique has 1 drawback, watch the video above to understand it. Comment down if you have any questions.
Source Code :-
dynamic.php
<head>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){ $("b").click(function()
    {
    document.getElementById("include").innerHTML = "<?php echo include('Second.php');
?> "; });
    $(document).on("click", "a.remove" , function()
    { $(this).parent().remove(); }); });
</script>
</head>
<body>
<b><input type='submit' value='Add second page'></b>
<div id='include'></div>
</body>

Second.php
<?php
echo 'This is second page';
?>