Posts

Showing posts from 2015

หน้าล็อกอิน Authentication Login manual บน Laravel 5

Authentication Login manual 1. Create controller cmd command Or custom create php file สร้างไว้ที่ App\Http\Controller\AccountController.php php artisan make : controller [Name]Controller code: AccountCobtroller.php <?php namespace App\Http\Controllers; use Input; use Session; use Auth; use View; use Hash; use App\Account; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Redirect; class AccountController extends Controller { public function __construct() { // } /**********************************************************************/ /*******************************Login**********************************/ /**********************************************************************/ public function getLogin() { if (Auth::check()) { // return Redirect::to('')->with('success', 'You are already logged in'); retur...

[RESOLVED] Call to undefined function pg_query (), Wamp Server PostgreSQL

[RESOLVED] Call to undefined function pg_query (), Wamp Server PostgreSQL [RESOLVED] Call to undefined function pg_query (), Wamp Server PostgreSQL to install our beloved localhost test server, and try to start connecting with the great aand PHP DB Manager PostgrSQL we noticed a very common mistake that would be   Call to undefined function pg_query () which is solved by doing the following:  1 ..- activate our php.ini extensions that brings WampServer, and extensions that we have are:    php_pgsql.dll   ,  php_pdo_pgsql.dll    these extensions are enabled clearing to the point semicolon (;) is in front of the name (Example:;  php_pdo_pgsql.dll remove it; there are forward and becomes:     php_pdo_pgsql.dll  ), save changes in php.ini.  2. NEXT go to the route:          C: \ wamp \ bin \ php \ php5.4.3 We place the library call:    libpq.dll    t...

Performing Inner Join for Multiple Columns in the Same Table

Performing Inner Join for Multiple Columns in the Same Table tbColors color_code , color_name 1 , 'blue' 2 , 'green' 3 , 'yellow' 4 , 'red' tbAnswers answer_id , favorite_color , least_favorite_color , color_im_allergic_to 1 , 1 , 2 3 2 , 3 , 1 4 3 , 1 , 1 2 4 , 2 , 3 4 This seems like the way to go: SELECT A . answer_id , C1 . color_name AS favorite_color_name , C2 . color_name AS least_favorite_color_name , C3 . color_name AS color_im_allergic_to_name FROM tbAnswers AS A INNER JOIN tbColors AS C1 ON A . favorite_color = C1 . color_code INNER JOIN tbColors AS C2 ON A . least_favorite_color =...

Tutorial: Using PHP’s JSON encode and decode functions to handle data sent to and from your app

Tutorial: Using PHP’s JSON encode and decode functions to handle data sent to and from your app JSON  makes dealing with data in your app exceptionally easy and manageable. The best part about  JSON  is you can look at it and understand it. It’s not like the confusing spaghetti DOM that you get with XML, it’s a lean minimal representation of your data. If you’re dealing with chunks of data in your app, you want to be using  JSON . So while your app will happily eat up all the  JSON  you can throw at it, you still need to make it in the first place – and/or have a server side app that is capable of reading it. If, like me, you use PHP to handle things on a server then things are pretty straightforward. You can use PHP’s  json_encode  and  json_decode  functions. Encode will take your arrays, or objects, and create a  JSON  string of your data. While decode will take a  JSON  string, sent from your app, and turn...