Installing PHP 7.2 on Mac using Homebrew Check version php -v check brew is up to date brew update brew upgrade Unlink php version which is installed in the system brew unlink php71 Now final step to download** brew install php72 export PATH=/usr/local/php5/bin:$PATH

Ajax Autocomplete Search in Laravel 7 Step 1: Install laravel 7 using composer composer create-project –prefer-dist laravel/laravel laravel7search Step 2: Going inside of project using the command cd laravel7search Step 3: Setup MySQL database Now, configure this database in the .env file. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel7search DB_USERNAME=root DB_PASSWORD=root@123 Step 3: Create Migration and Model In this step, we have to create a migration for students table using Laravel 7 PHP artisan command, so first fire…

Use the ORDER BY statement to sort the result in ascending order. import mysql.connector as mysql db = mysql.connect( host =”localhost”, username= “root”, password = “root@123”, database = “realprogrammers” ) cursor = db.cursor() # defining the query query = “SELECT * FROM user ORDER BY user_name” cursor.execute(query) result = cursor.fetchall() for x in result: print(x) Fetch data only column import mysql.connector as mysql db = mysql.connect( host =”localhost”, username= “root”, password = “root@123”, database = “realprogrammers” ) cursor = db.cursor() # defining the query query =…

Update keyword is used to Update the records from the table. import mysql.connector as mysql db = mysql.connect( host =”localhost”, username= “root”, password = “root@123”, database = “realprogrammers” ) cursor = db.cursor() # defining the query query = “UPDATE user SET user_name = ‘Saurabhshukla018’ WHERE name =’Saurabh'” cursor.execute(query) db.commit() print(cursor.rowcount, “record(s) affected”)

DELETE keyword is used to delete the records from the table. DELETE FROM table_name WHERE condition statement is used to delete records. If you don’t specify the condition, then all of the records will be deleted. Let’s delete a record from the user table with named Siddharth. import mysql.connector as mysql db = mysql.connect( host=”localhost”, user=”root”, passwd=”root@123″, database=”realprogrammer” ) cursor = db.cursor() ## defining the Query query = “DELETE FROM users WHERE name = ‘Siddharth'”…

Where is used to select data on condition. Now, we will select a record with name Siddharth. SELECT column_name FROM table_name WHERE condition statement will be used to retrieve the data on some condition. import mysql.connector as mysql db = mysql.connect( host=”localhost”, user=”root”, passwd=”root@123″, database=”realprogrammer” ) cursor = db.cursor() ## defining the Query query = “SELECT * FROM user WHERE name = ‘Siddharth'” ## getting records from the table cursor.execute(query) ## fetching all records from…

import mysql.connector as mysql db = mysql.connect( host=”localhost”, user=”root”, passwd=”root@123″, database=”realprogrammer” ) cursor = db.cursor() ## defining the Query query = “SELECT user_name FROM user” ## getting ‘user_name’ column from the table cursor.execute(query) ## fetching all usernames from the ‘cursor’ object usernames = cursor.fetchall() for username in usernames: print(username)

To retrieve the data from a table we use, SELECT column_names FROM table_name statement. Getting All Records From Table import mysql.connector as mysql db = mysql.connect( host=”localhost”, user=”root”, passwd=”root@123″, database=”realprogrammer” ) cursor = db.cursor() ## defining the Query query = “SELECT * FROM user” ## getting records from the table cursor.execute(query) records = cursor.fetchall() ## Showing data for record in records: print(record)