Skip to main content

Create Json code from MySQL database with php


Create Json code  from MySQL database with php  
--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Table structure for table `page`
--

CREATE TABLE IF NOT EXISTS `page` (
  `page_id` int(11) NOT NULL,
  `page_title` text NOT NULL,
  `page_url` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `page`
--

INSERT INTO `page` (`page_id`, `page_title`, `page_url`) VALUES
(1, 'JSON - Dynamic Dependent Dropdown List using Jquery and Ajax', 'json-dynamic-dependent-dropdown-list-using-jquery-and-ajax'),
(2, 'Live Table Data Edit Delete using Tabledit Plugin in PHP', 'live-table-data-edit-delete-using-tabledit-plugin-in-php'),
(3, 'Create Treeview with Bootstrap Treeview Ajax JQuery in PHP\r\n', 'create-treeview-with-bootstrap-treeview-ajax-jquery-in-php'),
(4, 'Bootstrap Multiselect Dropdown with Checkboxes using Jquery in PHP\r\n', 'bootstrap-multiselect-dropdown-with-checkboxes-using-jquery-in-php'),
(5, 'Facebook Style Popup Notification using PHP Ajax Bootstrap\r\n', 'facebook-style-popup-notification-using-php-ajax-bootstrap'),
(6, 'Modal with Dynamic Previous & Next Data Button by Ajax PHP\r\n', 'modal-with-dynamic-previous-next-data-button-by-ajax-php'),
(7, 'How to Use Bootstrap Select Plugin with Ajax Jquery PHP\r\n', 'how-to-use-bootstrap-select-plugin-with-ajax-jquery-php'),
(8, 'How to Load CSV File data into HTML Table Using AJAX jQuery\r\n', 'how-to-load-csv-file-data-into-html-table-using-ajax-jquery'),
(9, 'Autocomplete Textbox using Typeahead with Ajax PHP Bootstrap\r\n', 'autocomplete-textbox-using-typeahead-with-ajax-php-bootstrap'),
(10, 'Export Data to Excel in Codeigniter using PHPExcel\r\n', 'export-data-to-excel-in-codeigniter-using-phpexcel');


PHP code : -

<?php 
//sitemap.php
$connect = mysqli_connect("localhost", "root", "", "test");

$query = "SELECT page_url FROM page";

$result = mysqli_query($connect, $query);

$base_url = "http://localhost/app/test/sitemap/";
 echo "<pre>";
while($row = mysqli_fetch_array($result))
{
   $row = json_encode($row);

   echo ($row);
   echo "<br/>";
}


?>
 output:


{"0":"json-dynamic-dependent-dropdown-list-using-jquery-and-ajax","page_url":"json-dynamic-dependent-dropdown-list-using-jquery-and-ajax"}
{"0":"live-table-data-edit-delete-using-tabledit-plugin-in-php","page_url":"live-table-data-edit-delete-using-tabledit-plugin-in-php"}
{"0":"create-treeview-with-bootstrap-treeview-ajax-jquery-in-php","page_url":"create-treeview-with-bootstrap-treeview-ajax-jquery-in-php"}
{"0":"bootstrap-multiselect-dropdown-with-checkboxes-using-jquery-in-php","page_url":"bootstrap-multiselect-dropdown-with-checkboxes-using-jquery-in-php"}
{"0":"facebook-style-popup-notification-using-php-ajax-bootstrap","page_url":"facebook-style-popup-notification-using-php-ajax-bootstrap"}
{"0":"modal-with-dynamic-previous-next-data-button-by-ajax-php","page_url":"modal-with-dynamic-previous-next-data-button-by-ajax-php"}
{"0":"how-to-use-bootstrap-select-plugin-with-ajax-jquery-php","page_url":"how-to-use-bootstrap-select-plugin-with-ajax-jquery-php"}
{"0":"how-to-load-csv-file-data-into-html-table-using-ajax-jquery","page_url":"how-to-load-csv-file-data-into-html-table-using-ajax-jquery"}
{"0":"autocomplete-textbox-using-typeahead-with-ajax-php-bootstrap","page_url":"autocomplete-textbox-using-typeahead-with-ajax-php-bootstrap"}
{"0":"export-data-to-excel-in-codeigniter-using-phpexcel","page_url":"export-data-to-excel-in-codeigniter-using-phpexcel"}


Comments

Popular posts from this blog

Minimum and maximum number with - and + 500 in Mysql and Sql query and Find out table scheema of our database in Mysql and sql query and Find out all table name of our database in Mysql and sql query and Find out current date and time in mysql and sql help of sql query

Minimum and maximum number with - and + 500 in Mysql and Sql query:- syntax:-  SELECT MIN(Used)-500 , max(Used)+500 FROM audit Find out current date and time in mysql and sql help of sql query:- syntax:- SELECT now() Find out database name in Mysql and sql query:- syntax:-  SELECT DATABASE(); Find out all table name of our database in Mysql and sql query:- syntax:- SHOW TABLES; Find out   table scheema   of our database in Mysql and sql query:- syntax:- DESCRIBE <table name>;

PHP STRING FUNCTION WITH OUTPUT AND EXAMPLE

PHP STRING FUNCTION  WITH OUTPUT AND EXAMPLE  <?php   $var="my name is saddam hussain saifi ";   print_r(explode("a",$var)); //output:Array ( [0] => my n [1] => me is s [2] => dd [3] => m huss [4] => in s [5] => ifi )       echo crypt($varws);//output:-$1$m5/.1//.$KRawtTgnzzScShDJN3aHa.     echo crc32($var);//output:-1732983884  echo count_chars($var ,4);//output;-!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`bcgjklopqrtvwxz{|}~€ ‚ƒ„…†‡ˆ‰Š‹Œ Ž ’“”•–—˜™š›œ žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ    echo convert_uuencode($var);//output:-@;7D@;F%M92!I      echo convert_uudecode($var);// output:d4P L@M     echo convert_cyr_string($var,'m','a');       echo chunk_split($var,2,"(sam)");//output:-my(sam) n(sam)am(sam)e (sam)is(sam) s(sam)ad(sam)da(sam)m (sam)hu(sam)ss(sam)ai(sam)n (sam)s...

Notice: register_sidebar was called incorrectly. No id was set in the arguments array for the "Sidebar Top" sidebar.

Notice: register_sidebar was called incorrectly. No id was set in the arguments array for the "Sidebar Top" sidebar. add this code:-wp-include/config.php   change: define('WP_DEBUG', flase);  to below code here: // Enable WP_DEBUG mode define('WP_DEBUG', true); // Enable Debug logging to the /wp-content/debug.log file define('WP_DEBUG_LOG', true); // Disable display of errors and warnings  define('WP_DEBUG_DISPLAY', false); @ini_set('display_errors',0);