How-to articles, tricks, and solutions about PHP
It looks like you are trying to use a function from the MySQL extension in PHP, but you are getting an error saying that the first parameter should be a resource.
mysqli and PDO are both PHP extensions used for interacting with databases.
This error message typically indicates that there was a problem trying to establish a connection to the MySQL server.
The mysqli_fetch_array() function in PHP is used to retrieve rows of data from a MySQL database query result, and return the data as an array.
This error message is typically encountered when an attempt to execute a MySQLi query has failed.
In order to include new lines in the body of an email sent with PHP, you will need to use the proper new line characters.
There are several reasons why Nginx may serve PHP files as downloads instead of executing them.
This error message can have several causes.
In PHP7, nullable return types were introduced, allowing a function to return either a specific type or null.
This error message in Codeigniter indicates that you are attempting to return a variable by reference, but only variable references can be returned by reference.
In PHP, you can output an image using the built-in function header() to set the content type to an image format and the readfile() function to read the image file and output its contents.
I'm sorry to hear that you're having trouble installing PHP on your Ubuntu 16.04 system.
To parse the domain from a URL in PHP, you can use the parse_url function, which will return an associative array containing information about the URL.
To pass an array to a WHERE clause in PHP, you can use the implode function to join the array elements with a comma separator and use them in your WHERE clause.
There are several ways to pass variables from one PHP page to another.
To get the last inserted ID using PDO, you can use the PDO::lastInsertId() method after inserting a row into the database.
To insert data into a database using PDO and prepared statements, you can use the following steps:
This error message typically indicates that there is a problem connecting to the database using PHP's PDO (PHP Data Objects) library.
The __get and __set magic methods in PHP are used to intercept calls to get or set the value of inaccessible properties of an object.
To refresh a page in PHP, you can use the header function to send the HTTP "Refresh" header to the client's browser.
You can use the array_diff() function to check if two arrays are equal.
To copy an image from a URL and save it to your server using PHP, you can use the following function:
To extract a property from an array of objects in PHP, you can use the array_column function.
To decode a base64 encoded image string and save it as a JPG file in PHP, you can use the following code:
There are several reasons why the setcookie() function may not be working.