Posts

MySQL - Stored Procedures && Functions

A stored procedure is basically like a function jo apny andr different queries store kr skta h aur run be krta h on server side(PHPMyAdmin). it can have both parameters and no parameters. //CREATE PROCEDURE.  Go to Routes CREATE PROCEDURE sp_test () BEGIN SELECT ' Number of records : ', count(*) from test;  END DELIMITER / / CREATE PROCEDURE sp_select_suborders( IN `p_subId`) IF EXISTS ( SELECT * FROM suborders WHERE subId = p_subId ) THEN BEGIN SELECT * FROM suborders WHERE subId = p_subId END ELSE BEGIN SELECT id FROM orders WHERE id = p_subId LIMIT 1 END DELIMITER ; CALL STORED PROCEDURES IN CODE(the result will be in the array)      $stmt = $db ->prepare( 'CALL sp_select_suborders(?)' );    $ this ->db->query( 'EXEC procedureName $param1 $param2 $param3 ,...' ) //LINKS TO USE https://medium.com/mobiosolutions/create-stored-procedures-in-php-myadmin-ccf02c323a7e //LARAVEL https:/

crons job

Image
 config.php <?php $servername = "localhost"; $username = "pakpoultrypk_website"; $password = "qhofB132"; $db = "pakpoultrypk_website"; // Create connection $con = mysqli_connect($servername, $username, $password,$db); // Check connection if (!$con) {   die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?> mainfile.php #!/usr/bin/php  Or use this #!/usr/bin/env php <?php    require_once('config.php');   $date = date('Y-m-d');   mysqli_query($con,"DELETE FROM broiler WHERE expDate<='$date'");   mysqli_query($con,"DELETE FROM chicksBroiler WHERE expDate<='$date'");   mysqli_query($con,"DELETE FROM chicksDomestic WHERE expDate<='$date'");   mysqli_query($con,"DELETE FROM domesticFarming WHERE expDate<='$date'");   mysqli_query($con,"DELETE FROM eggDomestic WHERE expDate<='$date

Laravel 8 Multi Auth (Authentication) Tutorial

Image
  Step 1: Install Laravel 8 first of all we need to get fresh Laravel 8 version application using bellow command, So open your terminal OR command prompt and run bellow command: composer create-project --prefer-dist laravel/laravel blog Step 2: Database Configuration In second step, we will make database configuration for example database name, username, password etc for our crud application of laravel 8. So let's open .env file and fill all details like as bellow: .env DB_CONNECTION = mysql DB_HOST = 127.0 . 0.1 DB _PORT = 3306 DB _DATABASE = here your database name ( blog ) DB_USERNAME = here database username ( root ) DB_PASSWORD = here database password ( root ) Read Also:   Laravel 8 Create Custom Helper Functions Tutorial Step 3: Update Migration and Model In this step, we need to add new row "is_admin" in users table and model. than we need to run migration. so let's change that on both file. database/migrations/000_create_users_table.php <? php use Illu