Category : MySql



Simple PHP Jquery Ajax CRUD(insert update delete) tutorial example with source code

Today, I want to share with you PHP Mysql CRUD using Jquery Ajax from scratch. CRUD stands for Create, Read, Update and Delete database data. Add, Edit, Update, and Delete functionality is used almost every PHP application. But today i will show you very simple way to crud using bootstrap model. In this tutorial we will do insert, update and delete task for items. In this example i also use bootstrap for layout. I write just few step to follow you can make simple crud application with jquery pagination in your laravel 5 project. In this example i used several jquery Plugin for fire Ajax, Aja.....

By Hardik Savani | November 14, 2016 | | 374775 Viewer | Category : MySql
READ MORE

PHP Script - Login with Facebook using facebook-php-sdk and MySQL example with demo

In this post, I am going to share with you How to integrate login with facebook in PHP website using Facebook Graph API. In Website normally registration form for sign up, But users are not interested to filling the big registration forms. So you can implement login or register with facebook login, users don't require to fill big form. This tutorial will help to implement login with facebook in your PHP project. In this step by step post, i give you example of sign in with facebook account from scratch. In this example facebook account details will get and store it on MySQL database. After .....

By Hardik Savani | November 11, 2016 | | 41290 Viewer | Category : MySql
READ MORE

How to connect mysql database in node js with example?

Node.js is very popular in Todays for make chat system, real-time notification, real-time developing etc. So, Today, I am going to give you very simple example of How to use MySQL Query in Node JS. If you use node.js then you can see how it is work and there are several driver for different task like redis, socket io, express etc. But Node.js have a driver for MySQL that way we can easily connect with database and you can use select, insert, update and delete sql query. So, in this example i going to give from scratch so if you are beginner and you haven't installed nodejs on your server th.....

By Hardik Savani | September 29, 2016 | | 4727 Viewer | Category : MySql
READ MORE

How to get last 2 days records from table using Mysql Query?

We may sometimes require to get few days ago records from table like last 2 days, last 3 days, last 10 days or last 15 days etc. Most of developer choose other logic but we can easily get using mysql query(using CURDATE and INTERVAL). In this example mysql query i have one table "elements" and columns are id, title, description, created_at(timestamps) and update_at, Now we will get all records of last 2 days.so you can fetch fields value using CURDATE and INTERVAL of mysql. In following example you can see how to select data of last two days. <strong>Query:</strong> <pre> SELECT * FROM `elem.....

By Hardik Savani | July 22, 2016 | | 2956 Viewer | Category : MySql
READ MORE

How to get current year rows using MySql Query PHP?

If you require to get all the records of current year using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this year. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current year. <strong>Example:</strong> <pre> SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 YEAR); </pre>

By Hardik Savani | June 14, 2016 | | 1313 Viewer | Category : MySql
READ MORE

How to calculate age from date of birth column in mysql?

Sometimes, we require to get age from birthdate using mysql select query, we can do it in programming like php,.net and etc framework but if we can do it using mysql query. In bellow example mysql query you can learn how to get age from date field. We can get age value from using mysql DATEDIFF(). So, let's see bellow query. <strong>Example:</strong> <pre> SELECT id, (DATEDIFF(CURRENT_DATE, STR_TO_DATE(born_date, '%Y-%m-%d'))/365) as age FROM `users` </pre>

By Hardik Savani | June 1, 2016 | | 2991 Viewer | Category : MySql
READ MORE

How to rename column name foreign key constraint in MySql Query?

This is more one post on mysql query, I don't remember exactly time but i had need to change name of foreign key constraint column field. We can rename field name easily if we didn't set foreign key constraint. But if you set foreign key constraint then you can't rename easily. I had rename directly from my phpmyadmin without mysql query but i found bellow error: <pre> Query error: #1025 - Error on rename of './learn/#sql-46c_246' to './learn/my_table' (errno: 150) </pre> But i found the solution of mysql rename foreign key constraint using mysql query, First we have to drop the foreign key,.....

By Hardik Savani | May 4, 2016 | | 5389 Viewer | Category : MySql
READ MORE

Example of trigger on after delete with update query mysql

Sometimes we need to fire trigger like after delete update some fields of another tables. for example if you have chat_message tables and when remove row on this table then we need to update "remove_counter(remove_counter + 1)" on users table. i did give you bellow example you can see how to write trigger code: <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> delimiter // CREATE TRIGGER add_ban_counter_in_users AFTER DELETE ON `chat_messages` FOR EACH ROW BEGIN UPDATE `users` SET remove_counter = users.remove_counter + 1 WHERE users.id = old.user_id.....

By Hardik Savani | April 5, 2016 | | 1927 Viewer | Category : MySql
READ MORE

How to get current month data in MySql PHP ?

If you require to get all the records of current month using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this month. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current month. <strong class="example">Example:</strong> <pre class="language-mysql">SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 MONTH);</pre>

By Hardik Savani | March 17, 2016 | | 4421 Viewer | Category : MySql
READ MORE

Sql function remove numeric characters from column example

Mysql custom fucntion is a very prety and intresting concept. In this posts i want to create one custom mysql function for remove numeric characters from table field value. this function through you can also remove numeric characters from string in mysql. in following sql query fire in your mysql or mssql database and check how it works. So, lets create function and how to use in select statement in sql query. <strong class="step">Create removeNumber function:</strong> <pre class="prettyprint lang-mysql"> DROP FUNCTION IF EXISTS removeNumber; DELIMITER | CREATE FUNCTION removeNumber( str CH.....

By Hardik Savani | March 12, 2016 | | 1098 Viewer | Category : MySql
READ MORE

    PHP - jquery datatables with mysql database example from scratch

    PHP - jquery datatables with mysql database example from scratch

    Open Post

    Laravel 5.3 Image Upload with Validation example

    Laravel 5.3 Image Upload with Validation example

    Open Post

    Laravel 5 - How to create API Authentication using Passport ?

    Laravel 5 - How to create API Authentication using Passport ?

    Open Post

    PHP - Input multiple tags with dynamic autocomplete example

    PHP - Input multiple tags with dynamic autocomplete example

    Open Post

    AngularJS - convert comma separated string to array example

    AngularJS - convert comma separated string to array example

    Open Post

    Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo

    Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo

    Open Post