Welcome to LinuxScrew

A site for Linux lovers worldwide. For newbies, system engineers, administrators, and everybody in between. We cover all things Linux, plus various programming languages, including Python, Javascript, and PHP.

View our featured tutorials and projects in the slider below or scroll down to see all recent articles.

How to Convert a USB Printer to Wireless with a Raspberry Pi
How to Use a Raspberry Pi for Digital Signage
The Worst Things You’ll Probably Google As a Programmer on Linux
How to Build a Raspberry Pi Internet Kiosk
Browsing the Internet on a 1989 Macintosh II with a Web Rendering Proxy
previous arrow
next arrow
Slider

How to Use the MySQL/MariaDB COUNT Function, With Examples

MySQL Count

This quick article will demonstrate how to use the MySQL/MariaDB COUNT function to count the number of records returned by a query. MySQL/MariaDB COUNT Function Syntax COUNT(query) Note that: query can be an SQL query or a string representing a column name Null values found by the query will not be counted The COUNT function will return the number of matching records for a query and should be combined with the SELECT statement to output the result. Example Data The below examples use the following … Read more

The MySQL/MariaDB DELETE Statement – How to Use It

MySQL Delete

Being able to delete data from a table in a database is a pretty important thing – This article will show you how it’s done in MySQL/MariaDB. MySQL DELETE Statement Syntax In its basic usage, the DELETE operator is used in conjunction with a WHERE query to delete records matching that query: DELETE FROM table WHERE query; Note that: table is the table you wish to delete records from query is the query that defines the conditions records should match to be deleted Safety First! Please … Read more

How to List/Show Users in MySQL/MariaDB

MySQL Show List Users

This short article will show you how to list all of the users on your MySQL server. MySQL Users and Permissions MySQL databases usually have access granted to only certain users, each with their own permissions limiting what they can and can’t do on that specific database. As there are often multiple databases on a server, there will be several user accounts – some for different databases, some from different hosts – so it’s useful to be able to list them all out quickly. Command … Read more

How to Update Records – MySQL UPDATE Statement

MySQL Update

This article will show you how to use the MySQL/MariaDB UPDATE statement to update existing database records. MySQL/MariaDB UPDATE Syntax The syntax for the MySQL UPDATE statement requires the use of two keywords, UPDATE, and SET, and is as follows: UPDATE table SET column = value WHERE conditions; Note that: table is the name of the table which contains the records to be updated column = value defines which column to update and what the new value for that column should be Multiple column/value pairs can be defined, separated by a … Read more

How To Get Info About your PHP Environment Using phpinfo()

PHP phpinfo()

This article will explain what the phpinfo() function does and how to use it to get information about the PHP environment on your system. Many PHP packages and platforms (like WordPress, Laravel, and Symfony) have system requirements beyond what is included in the base PHP installation on most systems. These required modules include things like support for encryption, database support, and the ability to make HTTP requests from within PHP. To ensure that your PHP environment meets these conditions before trying to run the software, you … Read more

Categories PHP

Merging/Combining Arrays in PHP with array_merge [Examples]

PHP array_merge

This article will explain how to merge arrays using the PHP array_merge function and provide some code examples. What is an Array? An array is a type of PHP variable that can hold other values, or references to other variables, in a list at a certain position. Arrays are really useful – allowing you to store a list of variables or values of any length in a single variable – ready to be iterated over, printed as the rows in a table, or otherwise processed. Arrays might … Read more

Categories PHP

Using PHP cURL To Retrieve Data or Talk to an API

PHP cURL

The PHP cURL library adds support for requesting and submitting data over HTTP connections. This article will show you how to use it. There are a plethora of useful online services you can pull data from. From mapping to currency conversion, weather, flight schedules, language translations (in fact, just look at a big list of them here), these services, called APIs (Application Programming Interface), allow you to interact with massive databases of information over the HTTP protocol. PHP includes the tools to do this in its … Read more

Categories PHP

Formatting Numbers with number_format() in PHP [Examples]

PHP Number Format

This article will explain how to use the PHP number_format() function, with some helpful examples. Different regions use different number formatting – Some countries, including the UK, USA, Australia, and New Zealand, use a comma (,) to separate thousands when writing large numbers and use a period (.) as a decimal separator. Your computer most likely uses the same formatting when storing number values in a database. However, some countries, like Germany, use a period as the thousands separator and a comma as the decimal separator. Others … Read more

Categories PHP

Using PHP unset Function to Destroy a Variable, With Examples

PHP unset()

Here’s a short article on a useful PHP feature – the unset construct allows you to destroy a variable, making it unavailable for use. There are a few reasons why you might want to unset a variable: Making sure you don’t accidentally use a variable you don’t want to use in a certain context or scope Cleaning up variables after a loop Make a global variable unavailable within a function or scope Remove an element from an Array Remove an object attribute Read on to see how it’s done. … Read more

Categories PHP

Multi-Line Comment Blocks in Python – HowTo, With Examples

Python multi-line comment block

This short article will show you how to use comments in Python, including multi-line comments. What is a Comment? A comment in programing is one or more lines of text that aren’t interpreted as programming instructions. Instead, the computer skips them when executing your code, completely ignoring them. Therefore, comments don’t have to conform to any valid syntax. They’re just text that you read, and the computer doesn’t. Single-Line Comments in Python Comments in Python are any line that starts with a # (hash) character. # This … Read more