· Need a dynamic poll in which when user enters the data it stores data in database and the poll percentage got increased · Two polls needed using html,css Javascript, mysql database · Create and get...

1 answer below »
just need code


· Need a dynamic poll in which when user enters the data it stores data in database and the poll percentage got increased · Two polls needed using html,css Javascript, mysql database · Create and get api localhost:8080 · Need a dynamic poll in which when user enters the data it stores data in database and the poll percentage got increased · Two polls needed using html,css Javascript, mysql database · Create and get api localhost:8080
Answered 1 days AfterJul 28, 2021

Answer To: · Need a dynamic poll in which when user enters the data it stores data in database and the poll...

Kshitij answered on Jul 29 2021
133 Votes
GreyNodes/database_connection.php
//database_connection.php
$connect = new PDO('mysql:host=localhost;dbname=testing', 'root', '');
?>
GreyNodes/fetch_poll_data.php
//fetch_poll_data.php
include('database_conne
ction.php');
$php_framework = array("HTML", "CSS", "JAVASCRIPT", "REACTJS", "ANGULAR");
$total_poll_row = get_total_rows($connect);
$output = '';
if($total_poll_row > 0)
{
    foreach($php_framework as $row)
    {
        $query = "SELECT * FROM tbl_poll WHERE php_framework = '".$row."'";
        $statement = $connect->prepare($query);
        $statement->execute();
        $total_row = $statement->rowCount();
        $percentage_vote = round(($total_row/$total_poll_row)*100);
        $progress_bar_class = '';
        if($percentage_vote >= 40)
        {
            $progress_bar_class = 'progress-bar-success';
        }
        else if($percentage_vote >= 25 && $percentage_vote < 40)
        {
            $progress_bar_class = 'progress-bar-info';
        }
        else if($percentage_vote >= 10 && $percentage_vote < 25)
        {
            $progress_bar_class = 'progress-bar-warning';
        }
        else
        {
            $progress_bar_class = 'progress-bar-danger';
        }
        $output .= '
        

            

                
            

            

                

                    

                        '.$percentage_vote.' % programmer like '.$row.' PHP Framework
                    

                

            

        

        
        ';
    }
}
echo $output;
function get_total_rows($connect)
{
    $query = "SELECT * FROM tbl_poll";
    $statement = $connect->prepare($query);
    $statement->execute();
    return $statement->rowCount();
}
?>
GreyNodes/index.php
//index.php
?>


Live Poll System in PHP Mysql using Ajax

        

        


SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here