{"id":20509,"date":"2022-06-21T08:00:48","date_gmt":"2022-06-21T02:30:48","guid":{"rendered":"https:\/\/www.fusioncharts.com\/blog\/?p=20509"},"modified":"2022-06-30T08:59:04","modified_gmt":"2022-06-30T03:29:04","slug":"how-to-create-a-pie-chart-in-php-and-mysql","status":"publish","type":"post","link":"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/","title":{"rendered":"How To Create A Pie Chart In PHP And MySQL"},"content":{"rendered":"<p>PHP is one of the most common server-side scripting languages developers worldwide use for web development. When it comes to creating a <a href=\"https:\/\/www.fusioncharts.com\/php-charts?framework=php\" target=\"_blank\" rel=\"noopener\">PHP chart<\/a> using data contained in a database, most developers prefer the MySQL database. MySQL, an open-source RDBMS (<em>Relational Database Management System<\/em>), helps automate the process of retrieving data. Using PHP and MySQL together, developers can build just about any type of website, simple or complex. For example, you can create a pie chart in PHP and MySQL to display proportion\/relative data on your website\/web app.<\/p>\n<p>Are you looking to create a PHP chart? While charts are a great way to make sense of raw data, the general perception is that creating a PHP chart using data from the MySQL database is a difficult and time-consuming process. But it isn&#8217;t as difficult as you think if you\u2019re using an efficient charting library. In this article, we\u2019ll show you how to <a href=\"https:\/\/www.fusioncharts.com\/\" target=\"_blank\" rel=\"noopener\">create a pie chart in PHP MySQL<\/a> and why FusionCharts is the best PHP chart tool.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_71 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Why_Create_A_Pie_Chart_In_PHP_And_MySQL\" title=\"Why Create A Pie Chart In PHP And MySQL?\">Why Create A Pie Chart In PHP And MySQL?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Why_Use_FusionCharts_To_Create_A_Pie_Chart_In_PHP_and_MySQL\" title=\"Why Use FusionCharts To Create A Pie Chart In PHP and MySQL?\">Why Use FusionCharts To Create A Pie Chart In PHP and MySQL?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Can_You_Connect_Charts_Directly_To_Any_Database_Of_Your_Choice\" title=\"Can You Connect Charts Directly To Any Database Of Your Choice?\">Can You Connect Charts Directly To Any Database Of Your Choice?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Does_It_Support_a_Wide_Range_of_Charts_and_Graphs\" title=\"Does It Support a Wide Range of Charts and Graphs?\">Does It Support a Wide Range of Charts and Graphs?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Does_It_Allow_You_To_Create_Interactive_Charts\" title=\"Does It Allow You To Create Interactive Charts?\">Does It Allow You To Create Interactive Charts?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Can_You_Create_Live_Charts_With_PHP_Module_For_FusionCharts\" title=\"Can You Create Live Charts With PHP Module For FusionCharts?\">Can You Create Live Charts With PHP Module For FusionCharts?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Does_It_Allow_You_To_Export_Charts_and_Dashboards\" title=\"Does It Allow You To Export Charts and Dashboards?\">Does It Allow You To Export Charts and Dashboards?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Which_Type_of_PHP_Pie_Charts_Can_I_Create_With_FusionCharts\" title=\"Which Type of PHP Pie Charts Can I Create With FusionCharts?\">Which Type of PHP Pie Charts Can I Create With FusionCharts?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Pie_in_2D_and_3D\" title=\"Pie in 2D and 3D\">Pie in 2D and 3D<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Nested_Pie_in_2D\" title=\"Nested Pie in 2D\">Nested Pie in 2D<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#Donut_in_2D3D\" title=\"Donut in 2D\/3D\">Donut in 2D\/3D<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#How_Can_I_Create_A_Pie_Chart_In_PHP_and_MySQL_Using_FusionCharts\" title=\"How Can I Create A Pie Chart In PHP and MySQL Using FusionCharts?\">How Can I Create A Pie Chart In PHP and MySQL Using FusionCharts?<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Why_Create_A_Pie_Chart_In_PHP_And_MySQL\"><\/span><strong>Why Create A Pie Chart In PHP And MySQL?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-20510 size-full\" src=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2022\/06\/a.png\" alt=\"A simple pie chart in PHP MySQL\" width=\"799\" height=\"320\" srcset=\"\/blog\/wp-content\/uploads\/2022\/06\/a.png 799w, \/blog\/wp-content\/uploads\/2022\/06\/a-300x120.png 300w, \/blog\/wp-content\/uploads\/2022\/06\/a-768x308.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/p>\n<p>A pie chart is essentially a circular graph, where the circle is divided into different slices or sectors. Each slice in the chart shows a proportion of the whole. You can use these charts to represent categorical data and a parts-to-whole relationship.<\/p>\n<p>When it comes to creating a PHP pie chart, you can obtain the data for the chart statically by defining the data during the creation of the chart. However, the efficient way is to<strong> retrieve data<\/strong> <strong>dynamically<\/strong> from another source like MySQL. This way, your chart will always show up-to-date data. While there are several databases for PHP-based web development, MySQL is the most popular DBMS for PHP.<\/p>\n<p>Here are a few reasons why most PHP developers prefer MySQL:<\/p>\n<ul>\n<li>Provides an easy way to save website data<\/li>\n<li>Helps automate the process of retrieving data<\/li>\n<li>Create highly interactive web apps<\/li>\n<li>Cost-effective and functional<\/li>\n<li>Superior performance<\/li>\n<li>Open source<\/li>\n<li>Fast and easy maintenance<\/li>\n<li>Compatible with almost every modern server, such as Apache and IIS<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Why_Use_FusionCharts_To_Create_A_Pie_Chart_In_PHP_and_MySQL\"><\/span><strong>Why Use FusionCharts To Create A Pie Chart In PHP and MySQL?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are many open-source JavaScript chart libraries that you can use to create a pie chart in PHP MySQL. However, most of them are difficult to use. Additionally, most charting tools only support static images of the charts with low resolution. If you\u2019re looking for a powerful PHP chart library that is easy to use, FusionCharts is the best option. FusionCharts is a leading JavaScript charting library that is capable of rendering beautiful and interactive charts\/graphs in the browser.<\/p>\n<p>If you want to create a JavaScript pie chart in PHP, you can use the PHP module for FusionCharts. FusionCharts also supports a wide range of front-end integrations. Hence, you can also use it to create an angular pie chart or a React pie chart.<\/p>\n<p>Here are the <strong><em>main features of the PHP module for FusionCharts<\/em><\/strong>:<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_You_Connect_Charts_Directly_To_Any_Database_Of_Your_Choice\"><\/span><strong>Can You Connect Charts Directly To Any Database Of Your Choice?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>With the PHP module for FusionCharts, you don\u2019t have to worry about JavaScript methods and objects. You can simply write your app in native PHP or any other major PHP frameworks, such as <em>Laravel<\/em>, <em>Symphony<\/em>, or <em>CodeIgniter<\/em>, and easily fetch data from your SQL databases, including MySQL, and directly create dynamic and interactive charts.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Does_It_Support_a_Wide_Range_of_Charts_and_Graphs\"><\/span><strong>Does It Support a Wide Range of Charts and Graphs?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>FusionCharts\u2019 PHP module allows you to <a href=\"https:\/\/www.fusioncharts.com\/blog\/supercharge-your-php-apps-with-visually-stunning-interactive-charts\/\" target=\"_blank\" rel=\"noopener\">create more than 150 functional charts<\/a> for your web apps. These include pie charts, line charts, bar charts, column charts, area charts, Gantt charts, and many more.<\/p>\n<p>The PHP module also comes with event support for keyboard, mouse, and more. This feature allows you to add charts and graphs during any lifecycle phase of your app.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Does_It_Allow_You_To_Create_Interactive_Charts\"><\/span><strong>Does It Allow You To Create Interactive Charts?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Interactive charts make visualization even easier to understand, which in turn helps make informed decisions. With FusionCharts, you can create highly interactive charts that are responsive on all screen sizes.<\/p>\n<p>FusionCharts supports a number of user interactions:<\/p>\n<ul>\n<li>Zooming (zoom in and out)<\/li>\n<li>Panning<\/li>\n<li>Dragable charts<\/li>\n<li>Enable users to switch between values on a chart or graph<\/li>\n<li><a href=\"https:\/\/www.fusioncharts.com\/blog\/drill-down-javascript-charts-in-php-and-mysql-part-3\/\" target=\"_blank\" rel=\"noopener\">Add drill-downs to your charts<\/a><\/li>\n<li>Show or hide data series in column charts and many more<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Can_You_Create_Live_Charts_With_PHP_Module_For_FusionCharts\"><\/span><strong>Can You Create Live Charts With PHP Module For FusionCharts?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The PHP module for FusionCharts supports real-time updates or live charts. These charts update automatically after a specific interval to show real-time data.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Does_It_Allow_You_To_Export_Charts_and_Dashboards\"><\/span><strong>Does It Allow You To Export Charts and Dashboards?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>While most charting libraries don&#8217;t allow you to export full dashboards, FusionCharts PHP chart generator offers this feature. It allows you to export full live dashboards in different formats, such as PDF and image. You can also easily add any new elements to your exported dashboards, such as logos, colors, and tables.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Which_Type_of_PHP_Pie_Charts_Can_I_Create_With_FusionCharts\"><\/span><strong>Which Type of PHP Pie Charts Can I Create With FusionCharts?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Whether you want to create a financial pie chart or a 2D\/3D pie chart, FusionCharts supports a wide range of pie charts:<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Pie_in_2D_and_3D\"><\/span><strong>Pie in 2D and 3D<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>A 2D or 3D pie chart is great for representing the share of constituents as part of the whole. A 3D pie chart essentially adds depth to a plain pie chart and makes it visually appealing.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Nested_Pie_in_2D\"><\/span><strong>Nested Pie in 2D<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img loading=\"lazy\" class=\"aligncenter wp-image-20511 size-full\" src=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2022\/06\/nested.png\" alt=\"nested pie chart \" width=\"681\" height=\"547\" srcset=\"\/blog\/wp-content\/uploads\/2022\/06\/nested.png 681w, \/blog\/wp-content\/uploads\/2022\/06\/nested-300x241.png 300w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/p>\n<p>A nested 2D pie chart is a multi-level pie chart. You can you this PHP graph to represent symmetrical and asymmetrical tree structures.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Donut_in_2D3D\"><\/span><strong>Donut in 2D\/3D<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>A donut 2D or 3D pie chart is great for depicting the share of constituents as part of a whole. However, it also allows users to slice out different components\/sectors of the pie chart.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_Can_I_Create_A_Pie_Chart_In_PHP_and_MySQL_Using_FusionCharts\"><\/span><strong>How Can I Create A Pie Chart In PHP and MySQL Using FusionCharts?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With FusionCharts, you can create a pie chart in PHP MySQL by using the data string method or data URL method.<\/p>\n<p>Here, we\u2019ll create a sample pie chart for representing <em>&#8220;Production by Factory&#8221;<\/em> using the data string method. The database contains only two tables, namely <em>&#8220;Factory_Master\u201d<\/em> for storing the name and ID of factories and <em>\u201cFactory_Output\u201d<\/em> for storing the number of units produced by factories for a specific date.<\/p>\n<p>Here are the main steps for creating a pie chart in PHP MySQL :<\/p>\n<ol>\n<li>First, we need to include the FusionCharts.js JavaScript class and FusionCharts.php. This will help embed charts easily.<\/li>\n<li>Next, include DBConn.php to connect to the database.<\/li>\n<li>Generate XML document and store it in a strXML variable.<\/li>\n<li>Render the Pie 3D Chart with data from $strXML.<\/li>\n<\/ol>\n<p>Here is the sample code for creating the pie chart:<\/p>\n<pre class=\"lang:php\">&lt;?php\r\n      \/\/We've included ..\/Includes\/FusionCharts.php and ..\/Includes\/DBConn.php, which contains\r\n      \/\/functions to help us easily embed the charts and connect to a database.\r\n      include(\"..\/Includes\/FusionCharts.php\");\r\n      include(\"..\/Includes\/DBConn.php\");\r\n      ?&gt;\r\n      &lt;HTML&gt;\r\n         &lt;HEAD&gt;\r\n        &lt;TITLE&gt;FusionCharts - Database Example&lt;\/TITLE&gt;\r\n        https:\/\/..\/..\/FusionCharts\/FusionCharts.js\r\n     &lt;\/HEAD&gt;\r\n     &lt;BODY&gt;\r\n     &lt;CENTER&gt;\r\n     &lt;?php   \r\n   \/\/In this example, we show how to connect FusionCharts to a database.\r\n   \/\/For the sake of ease, we've used a MySQL database containing two\r\n   \/\/tables.\r\n   \/\/Connect to the DB\r\n   $link = connectToDB();\r\n   \/\/$strXML will be used to store the entire XML document generated\r\n   \/\/Generate the chart element\r\n     $strXML = \"&lt;chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'&gt;\";\r\n   \/\/Fetch all factory records\r\n     $strQuery = \"select * from Factory_Master\";\r\n     $result = mysql_query($strQuery) or die(mysql_error());\r\n   \/\/Iterate through each factory\r\n       if ($result) {\r\n          while($ors = mysql_fetch_array($result)) {\r\n          \/\/Now create a second query to get details for this factory\r\n           $strQuery = \"select sum(Quantity) as TotOutput from Factory_Output where FactoryId=\" . $ors['FactoryId'];\r\n           $result2 = mysql_query($strQuery) or die(mysql_error()); \r\n           $ors2 = mysql_fetch_array($result2); \r\n          \/\/Generate &lt;set label='..' value='..'\/&gt;\r\n           $strXML .= \"&lt;set label='\" . $ors['FactoryName'] . \"' value='\" . $ors2['TotOutput'] . \"' \/&gt;\";\r\n          \/\/free the resultset\r\n           mysql_free_result($result2);\r\n          }\r\n     }\r\n           mysql_close($link);\r\n           \/\/Finally, close &lt;chart&gt; element\r\n           $strXML .= \"&lt;\/chart&gt;\";\r\n           \/\/Create the chart - Pie 3D Chart with data from $strXML\r\n           echo renderChart(\"..\/..\/FusionCharts\/Pie3D.swf\", \"\", $strXML, \"FactorySum\", 600, 300, false, true);\r\n        ?&gt;\r\n  &lt;\/BODY&gt;\r\n&lt;\/HTML&gt;<\/pre>\n<p>The above code will render the following chart:<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter wp-image-20512 size-full\" src=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2022\/06\/code-output.jpg\" alt=\"create a pie chart in PHP MySQL using FusionCharts\" width=\"572\" height=\"273\" srcset=\"\/blog\/wp-content\/uploads\/2022\/06\/code-output.jpg 572w, \/blog\/wp-content\/uploads\/2022\/06\/code-output-300x143.jpg 300w\" sizes=\"(max-width: 572px) 100vw, 572px\" \/><\/p>\n<p>If you want to learn how to create a PHP MySQL chart using the data URL method, <a href=\"https:\/\/www.fusioncharts.com\/blog\/javascript-charts-using-php-and-mysql-with-fusioncharts-xt-part-2\/\" target=\"_blank\" rel=\"noopener\">check out this article<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.fusioncharts.com\/download\/fusioncharts-suite-xt?framework=js\" target=\"_blank\" rel=\"noopener\">Ready to create a pie chart in PHP MySQL with ease? Head over to FusionCharts and create more than 150 PHP charts!<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP is one of the most common server-side scripting languages developers worldwide use for web development. When it comes to creating a PHP chart using data contained in a database, most developers prefer the MySQL database. MySQL, an open-source RDBMS (Relational Database Management System), helps automate the process of retrieving data. Using PHP and MySQL [&hellip;]<\/p>\n","protected":false},"author":60,"featured_media":20514,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[722],"tags":[152,607,255,1096,1077,1098],"coauthors":[834],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Create A Pie Chart In PHP And MySQL<\/title>\n<meta name=\"description\" content=\"The best way to create a pie chart in PHP and MySQL is to use an efficient charting library like FusionCharts. Check out the full article.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Create A Pie Chart In PHP And MySQL\" \/>\n<meta property=\"og:description\" content=\"The best way to create a pie chart in PHP and MySQL is to use an efficient charting library like FusionCharts. Check out the full article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"FusionBrew - The FusionCharts Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-21T02:30:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-30T03:29:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"853\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sidra Arif\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sidra Arif\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\/\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#organization\",\n\t            \"name\": \"FusionCharts\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/\",\n\t            \"sameAs\": [],\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/\",\n\t                \"url\": \"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg\",\n\t                \"contentUrl\": \"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg\",\n\t                \"caption\": \"FusionCharts\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/\"\n\t            }\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#website\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/\",\n\t            \"name\": \"FusionBrew - The FusionCharts Blog\",\n\t            \"description\": \"Get tips and tricks on how to build effective Data Visualisation using FusionCharts\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\/\/www.fusioncharts.com\/blog\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": \"required name=search_term_string\"\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#primaryimage\",\n\t            \"url\": \"\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg\",\n\t            \"contentUrl\": \"\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg\",\n\t            \"width\": 1280,\n\t            \"height\": 853,\n\t            \"caption\": \"How To Create A Pie Chart In PHP And MySQL\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\",\n\t            \"name\": \"How To Create A Pie Chart In PHP And MySQL\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#primaryimage\"\n\t            },\n\t            \"datePublished\": \"2022-06-21T02:30:48+00:00\",\n\t            \"dateModified\": \"2022-06-30T03:29:04+00:00\",\n\t            \"description\": \"The best way to create a pie chart in PHP and MySQL is to use an efficient charting library like FusionCharts. Check out the full article.\",\n\t            \"breadcrumb\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#breadcrumb\"\n\t            },\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"BreadcrumbList\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#breadcrumb\",\n\t            \"itemListElement\": [\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 1,\n\t                    \"name\": \"Home\",\n\t                    \"item\": \"https:\/\/www.fusioncharts.com\/blog\/\"\n\t                },\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 2,\n\t                    \"name\": \"How To Create A Pie Chart In PHP And MySQL\"\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"Article\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Sidra Arif\",\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/8bab76a6506bb845121c297d68537827\"\n\t            },\n\t            \"headline\": \"How To Create A Pie Chart In PHP And MySQL\",\n\t            \"datePublished\": \"2022-06-21T02:30:48+00:00\",\n\t            \"dateModified\": \"2022-06-30T03:29:04+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/\"\n\t            },\n\t            \"wordCount\": 1161,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg\",\n\t            \"keywords\": [\n\t                \"FusionCharts\",\n\t                \"FusionCharts PHP Wrapper\",\n\t                \"mysql\",\n\t                \"PHP chart\",\n\t                \"php charts\",\n\t                \"PHP MySQL pie chart\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"FusionCharts\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/8bab76a6506bb845121c297d68537827\",\n\t            \"name\": \"Sidra Arif\",\n\t            \"image\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/image\/289f22ba6f2da5fab209e3f57ac58344\",\n\t                \"url\": \"\/blog\/wp-content\/wphb-cache\/gravatar\/635\/6357b27dc4a18c6c55eeed76ab42da6cx96.jpg\",\n\t                \"contentUrl\": \"\/blog\/wp-content\/wphb-cache\/gravatar\/635\/6357b27dc4a18c6c55eeed76ab42da6cx96.jpg\",\n\t                \"caption\": \"Sidra Arif\"\n\t            },\n\t            \"url\": \"\/blog\/author\/sidra24\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Create A Pie Chart In PHP And MySQL","description":"The best way to create a pie chart in PHP and MySQL is to use an efficient charting library like FusionCharts. Check out the full article.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/","og_locale":"en_US","og_type":"article","og_title":"How To Create A Pie Chart In PHP And MySQL","og_description":"The best way to create a pie chart in PHP and MySQL is to use an efficient charting library like FusionCharts. Check out the full article.","og_url":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/","og_site_name":"FusionBrew - The FusionCharts Blog","article_published_time":"2022-06-21T02:30:48+00:00","article_modified_time":"2022-06-30T03:29:04+00:00","og_image":[{"width":1280,"height":853,"url":"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg","type":"image\/jpeg"}],"author":"Sidra Arif","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sidra Arif","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/www.fusioncharts.com\/blog\/#organization","name":"FusionCharts","url":"https:\/\/www.fusioncharts.com\/blog\/","sameAs":[],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/","url":"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg","contentUrl":"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg","caption":"FusionCharts"},"image":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/www.fusioncharts.com\/blog\/#website","url":"https:\/\/www.fusioncharts.com\/blog\/","name":"FusionBrew - The FusionCharts Blog","description":"Get tips and tricks on how to build effective Data Visualisation using FusionCharts","publisher":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fusioncharts.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#primaryimage","url":"\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg","contentUrl":"\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg","width":1280,"height":853,"caption":"How To Create A Pie Chart In PHP And MySQL"},{"@type":"WebPage","@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/","url":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/","name":"How To Create A Pie Chart In PHP And MySQL","isPartOf":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#primaryimage"},"datePublished":"2022-06-21T02:30:48+00:00","dateModified":"2022-06-30T03:29:04+00:00","description":"The best way to create a pie chart in PHP and MySQL is to use an efficient charting library like FusionCharts. Check out the full article.","breadcrumb":{"@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fusioncharts.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Create A Pie Chart In PHP And MySQL"}]},{"@type":"Article","@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#article","isPartOf":{"@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/"},"author":{"name":"Sidra Arif","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/8bab76a6506bb845121c297d68537827"},"headline":"How To Create A Pie Chart In PHP And MySQL","datePublished":"2022-06-21T02:30:48+00:00","dateModified":"2022-06-30T03:29:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/"},"wordCount":1161,"commentCount":0,"publisher":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#primaryimage"},"thumbnailUrl":"\/blog\/wp-content\/uploads\/2022\/06\/smartmockups_l4n3poh8.jpg","keywords":["FusionCharts","FusionCharts PHP Wrapper","mysql","PHP chart","php charts","PHP MySQL pie chart"],"articleSection":["FusionCharts"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.fusioncharts.com\/blog\/how-to-create-a-pie-chart-in-php-and-mysql\/#respond"]}]},{"@type":"Person","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/8bab76a6506bb845121c297d68537827","name":"Sidra Arif","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/image\/289f22ba6f2da5fab209e3f57ac58344","url":"\/blog\/wp-content\/wphb-cache\/gravatar\/635\/6357b27dc4a18c6c55eeed76ab42da6cx96.jpg","contentUrl":"\/blog\/wp-content\/wphb-cache\/gravatar\/635\/6357b27dc4a18c6c55eeed76ab42da6cx96.jpg","caption":"Sidra Arif"},"url":"\/blog\/author\/sidra24\/"}]}},"_links":{"self":[{"href":"\/blog\/wp-json\/wp\/v2\/posts\/20509"}],"collection":[{"href":"\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/comments?post=20509"}],"version-history":[{"count":0,"href":"\/blog\/wp-json\/wp\/v2\/posts\/20509\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/media\/20514"}],"wp:attachment":[{"href":"\/blog\/wp-json\/wp\/v2\/media?parent=20509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/categories?post=20509"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/tags?post=20509"},{"taxonomy":"author","embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/coauthors?post=20509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}