Categories
JavaScript PHP Tutorials

Using jQuery AJAX and PHP how to fetch MySQL table records array as JSON format

Using jQuery AJAX and PHP how to fetch data from a MySQL database table as JSON format. The PHP script retrieves the MySQL tables records and send to client side jQuery Script as JSON string format. This tutorial also explains how to retrieve data from MySQL database in JSON format using PHP, AJAX & jQuery and how to convert MySQL records or rows in JSON format using PHP and jQuery.

Categories
PHP Tutorials

PHP mysqli code example to search MySQL database

In the following PHP program I have accessed the MySQL database (using PHP’s object oriented mysqli extension ) by a PHP function generated by me, and fetched a “MySQL database table” column value (Departments column) based on some key value in another column ( Serial ). So in a nutshell this program shows how – based on “primary key column value” of a “particular row” of a “single database table”, pick up “another column value” of that row in the same table.

Categories
PHP Tutorials Wordpress Tutorials

Add custom menu, Add theme locations & register new menu

A WordPress developers guide / tutorial – for adding custom menu in new wordpress theme, add one or multiple new theme locations for the custom WordPress menus, so that menu can appear in those places. Register new menu items. Enable your new wordpress theme to add custom user defined nav menus from the admin dashboard.

Categories
PHP Tutorials

PHP Syntax- heredoc, string, variables and constants, logical operators

PHP Tutorial- Chapter 1 (PHP Syntax)

How to use HEREDOC in PHP with examples, also use easy to use examples in PHP for declaring variables, constants. Also know which tags you can use in PHP script to write PHP code in it.

Categories
PHP Tutorials

Upload files using PHP explained

Upload files using PHP explained here in this example.

Categories
PHP Tutorials

PHP Code Example – How to connect MySQL database

The steps to connect MySQL database with PHP.  This program will work for database connection in PHP with MySQL in XAMPP or using WAMP server. A simplest example where a script of PHP connect to MySQL database and also this is an example of PHP program on database connection.

Categories
PHP Tutorials

Static Variables in PHP with simple example

Static in PHP:

Retains the local variable value and it donot loose its value at the end of function call.

<?php
function f()
{
static $x=1;
echo $x.”<br />”;
$x++;
}
f();
f();
?>

Output  of this program:

1
2

Categories
PHP Tutorials

WordPress problem in localhost- .htaccess causing internal server error 500

.htaccess in WAMP Server (in WordPress local installation) showing internal server error 500, how to solve it?

The solution is :

  • Left Mouse Click on Wampserver icon in the System Tray in Windows7/XP etc and
  • Goto Apache -> httpd.conf
  • a file will open and in it
  • and search “#LoadModule rewrite_module modules/mod_rewrite.so”.
  • Remove the # as below and save it as follows
  • LoadModule rewrite_module modules/mod_rewrite.so
  • then restart all service.

Actually you need to enable the mod_rewrite module in Apache server. In the httpd.conf file, the configuration file of Apache, find “LoadModule rewrite_module modules/mod_rewrite.so” and remove the pound (#) symbol from the beginning of this line and then save the file and restart WAMP by left mouse click- restart all services.

Also in some cases you need to change AllowOverride none in the httpd.conf to AllowOverride all as well. Read it in wordpress forum

Reference Reading :Some more information on Apache HTACCESS internal server error 500 in Wamp or wordpress installation in wamp server visit this page