3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Setup the connection to the database $con=mysqli_connect("mysql11.citynetwork.se","125966-hv96625","SidTheKidCrosby8778","125966-show-ratings"); $showID = get_the_ID(); // Fetch all available columns for the current show with the ID $showID $row = mysqli_fetch_array(mysqli_query($con,"SELECT * FROM `125966-show-ratings`.`ratings_for_shows` WHERE SHOW_ID=$showID")); $show_rating_link = ""; $show_rating_one_count = $row['one_vote']; $show_rating_two_count = $row['two_vote']; $show_rating_three_count = $row['three_vote']; $show_rating_four_count = $row['four_vote']; $show_rating_five_count = $row['five_vote']; $show_rating_six_count = $row['six_vote']; $show_rating_seven_count = $row['seven_vote']; $show_rating_eight_count = $row['eight_vote']; $show_rating_nine_count = $row['nine_vote']; $show_rating_ten_count = $row['ten_vote']; // Count the number of votes available in the database for all the fields $number_of_votes = $show_rating_one_count + $show_rating_two_count + $show_rating_three_count + $show_rating_four_count + $show_rating_five_count + $show_rating_six_count + $show_rating_seven_count + $show_rating_eight_count + $show_rating_nine_count + $show_rating_ten_count; // Count the sum of all the votes $sum_of_votes = 1 * $show_rating_one_count + 2 * $show_rating_two_count + 3 * $show_rating_three_count + 4 * $show_rating_four_count + 5 * $show_rating_five_count + 6 * $show_rating_six_count + 7 * $show_rating_seven_count + 8 * $show_rating_eight_count + 9 * $show_rating_nine_count + 10 * $show_rating_ten_count; // Count the max possible value $max_possible_sum = 10 * $number_of_votes; // Calculate the rating in percent with one decimal maximum $rating = round(($sum_of_votes / ($max_possible_sum) * 100) * 10) / 10;
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/1QHjt:3 Stack trace: #0 {main} thrown in /in/1QHjt on line 3
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function mysqli_connect() in /in/1QHjt on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: mysqli_connect() in /in/1QHjt on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: mysqli_connect() in /in/1QHjt on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: mysqli_connect() in /in/1QHjt on line 3