1 2 3 4 5 6 7 |
You'll need to use DB::raw(), perhaps something like Invite::where(DB::raw('BINARY `token`'), $token)->first(); or alternatively: Invite::whereRaw("BINARY `token`= ?",[$token])->first(); |
Category Sql
Go to wamp64\alias\ edit phpmyadmin.conf file then update size
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Alias /phpmyadmin "c:/wamp64/apps/phpmyadmin4.7.9/" <Directory "c:/wamp64/a... |
Directly run in sql
1 2 3 4 5 6 7 |
CREATE FUNCTION grade (grade_point INT) RETURNS VARCHAR(15) RETURN CASE WHEN grade_point >= 90 THEN "EXCELLENT" WHEN grade_point >= 80 THEN "GOOD" END |
Then use like
1 |
select grade (79) |
using in laravel
if you have a script called index.php that took a parameter called slug…
1 2 3 4 5 6 7 8 9 10 11 |
<?php if (isset($_GET['slug'])) { $sql = "SELECT * FROM `your_table` WHERE slug = ? LIMIT 1"; $smt = $pdo->prepare($sql); $smt->execute(array($_GET['slug'])); $row = $smt->fetchObject(); // do something with the matching record here... } else { // display home page } |
You could then re-write requests using ...
1 2 3 4 5 6 |
SELECT *, ( 6371 * acos( cos( radians({$lat}) ) * cos( radians( `lat` ) ) * cos( radians( `lng` ) - radians({$lng}) ) + sin( radians({$lat}) ) * sin( radians( `lat` ) ) ) ) AS distance FROM `positions` HAVING distance <= {$radius} ORDER BY distance ASC |
File 1