Snippets tagged “prepared-statements”
19 snippets use this tag.
- Connect to SQL Server through PDO using SQL Server DriverPHP
Here is an example of how to connect to a SQL Server database using PDO and the SQL Server driver:
- Error when preparing a multiple insert queryPHP
There are a few things that could cause an error when preparing a multiple insert query in PHP.
- Get Category name from Post IDPHP
To get the category name from a post ID in PHP, you can follow these steps:
- How can I prevent SQL injection in PHP?PHP
There are several ways to prevent SQL injection attacks in PHP.
- How can I replace the deprecated set_magic_quotes_runtime in php?PHP
The set_magic_quotes_runtime function has been deprecated since PHP 5.3 and removed in PHP 7.0.
- How do I display a MySQL error in PHP for a long query that depends on the user input?PHP
To display a MySQL error in PHP for a long query that depends on user input, you can use the mysqli_error() function.
- How to Check if a Record Exists in a MySQL DatabasePHP
In this tutorial, we are going to represent to you two handy options of how to check if a record exists in the database with PHP.
- How to escape strings in SQL Server using PHP?PHP
In PHP, you can use the sqlsrv_real_escape_string() function to escape strings in SQL Server.
- How to include a PHP variable inside a MySQL statementPHP
To include a PHP variable inside a MySQL statement, you need to use prepared statements with bound parameters.
- How to Prevent SQL Injection in PHPPHP
If you want to learn how to prevent SQL injection in PHP, as well as to get comprehensive information about SQL injections, you are in the right place.
- How to properly set up a PDO connectionPHP
To set up a PDO connection, you will need to do the following:
- MySQL Check if username and password matches in DatabasePHP
To check if a given username and password match those stored in a MySQL database, you can use a SQL SELECT statement with a WHERE clause.
- mysqli or PDO - what are the pros and cons?PHP
mysqli and PDO are both PHP extensions used for interacting with databases.
- PDO get the last ID insertedPHP
To get the last inserted ID using PDO, you can use the PDO::lastInsertId() method after inserting a row into the database.
- PDO with INSERT INTO through prepared statementsPHP
To insert data into a database using PDO and prepared statements, you can use the following steps:
- PHP mySQL - Insert new record into table with auto-increment on primary keyPHP
To insert a new record into a MySQL table that has an auto-increment primary key, you can use the INSERT statement with a list of comma-separated values.
- Select records from today, this week, this month php mysqlPHP
To select records from today, you can use the following code:
- Send html form data to sql database via php (using mysqli)PHP
To send HTML form data to a SQL database using PHP, you will need to use the mysqli (MySQL Improved) extension in PHP.
- Why shouldn't I use mysql_* functions in PHP?PHP
The mysql_* functions in PHP are deprecated, meaning that they are no longer recommended for use and will likely be removed in a future version of PHP.