Snippets tagged “sql”
40 snippets use this tag.
- "Database query failed: Data truncated for column 'column_name' at row 1PHP
This error message is indicating that a database query has failed due to data being too large to fit into a specific column in the database table.
- Codeigniter's `where` and `or_where`PHP
In CodeIgniter, the where method on the database class is used to add a WHERE clause to your query.
- Converting Varchar Value to Integer/Decimal Value in SQL ServerPHP
In SQL Server, you can convert a varchar value to an integer or decimal value using the CAST or CONVERT function.
- error in your SQL syntax; check the manual that corresponds to your MySQL serverPHP
This error message is indicating that there is a problem with the SQL syntax used in the query.
- Executing multiple SQL queries in one statement with PHPPHP
In PHP, you can execute multiple SQL queries in one statement by using the mysqli_multi_query() function.
- Get Category name from Post IDPHP
To get the category name from a post ID in PHP, you can follow these steps:
- Getting data posted in between two datesPHP
To get data posted between two dates in PHP, you can use a SQL query with a WHERE clause and the BETWEEN operator.
- Hibernate show real SQLJava
To show the real SQL generated by Hibernate, you can enable the show_sql property in the Hibernate configuration file (hibernate.cfg.xml).
- How can I log SQL statements in Spring Boot?Java
To log SQL statements in Spring Boot, you can configure the logging level of the org.hibernate.SQL logger to DEBUG or TRACE.
- How do I count unique visitors to my site?PHP
There are several ways to count unique visitors to a website using PHP, but one common method is to use cookies.
- How do I find out my MySQL URL, host, port and username?Java
To find out your MySQL connection details, you will need to look in your MySQL configuration files. The specific location of these files will depend on how you installed MySQL, but common locations include /etc/my.cnf,
- 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 count and group by in yii2PHP
In Yii2, you can use the count() and groupBy() methods in the query builder to count and group the results of a query, respectively.
- How to create a foreign key in phpmyadminPHP
To create a foreign key in PHPMyAdmin, follow these steps:
- How to create virtual column using MySQL SELECT?PHP
To create a virtual column using a MySQL SELECT statement, you can use the AS keyword to assign a name to an expression in the SELECT statement.
- How to get ID of the last updated row in MySQL?PHP
To get the ID of the last inserted row, you can use the LAST_INSERT_ID() function.
- How to get primary key of table?PHP
To get the primary key of a table in PHP, you can use the SHOW KEYS SQL statement to retrieve information about the keys (including the primary key) of a table.
- How to print exact sql query in zend framework ?PHP
In Zend Framework, you can use the Zend_Db_Select object's __toString() method to print the exact SQL query that will be executed.
- How to properly set up a PDO connectionPHP
To set up a PDO connection, you will need to do the following:
- How to resolve ambiguous column names when retrieving results?PHP
When retrieving results in PHP and encountering ambiguous column names, you can use table aliases to specify which table the column belongs to.
- How to separate DATE and TIME from DATETIME in MySQL?PHP
You can use the DATE() and TIME() functions to extract the date and time parts of a DATETIME value in MySQL.
- How to use php array with sql IN operator?PHP
You can use the implode() function to convert the PHP array into a string of comma-separated values, and then use that string in the SQL query with the IN operator.
- In PHP with PDO, how to check the final SQL parametrized query?PHP
In PHP with PDO, you can use the debugDumpParams() method on a prepared statement object to view the final SQL parametrized query.
- Insert data into multiple tables using one formPHP
To insert data into multiple tables using one form in PHP, you can use a single SQL statement with multiple INSERT INTO clauses, or you can use multiple individual SQL statements, one for each table.
- Java ResultSet how to check if there are any resultsJava
To check if a ResultSet object contains any results in Java, you can use the next method of the ResultSet class.
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)Java
A java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) error typically indicates that the MySQL server is unable to authenticate the user with the provided username and password.
- MySQL - How to select rows where value is in array?PHP
You can use the IN operator to select rows where the value is in an array.
- 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.
- MySQL Great Circle Distance (Haversine formula)PHP
The Haversine formula is a mathematical formula that can be used to calculate the great-circle distance between two points on a sphere, such as the Earth.
- MySQL JDBC Driver 5.1.33 - Time Zone IssueJava
If you are using MySQL JDBC Driver version 5.1.33 and you are experiencing issues with time zones, there are a few things you can try:
- MySQL query to get column names?PHP
To get the column names of a table in MySQL, you can use the SHOW COLUMNS FROM command.
- MySQL server has gone away - in exactly 60 secondsPHP
The "MySQL server has gone away" error message typically indicates that the connection to the MySQL server was lost.
- Passing an array to a query using a WHERE clausePHP
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.
- php artisan migrate - SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost'PHP
This error message is indicating that the PHP script, "artisan," is attempting to run a database migration command, but the database server is denying access to the user "laravel" on the "localhost" location.
- 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.
- Resetting MySQL Root Password with XAMPP on LocalhostPHP
To reset the root password for MySQL on XAMPP, you can follow these steps.
- Select mySQL based only on month and yearPHP
To select data from a MySQL database based on the month and year, you can use the MONTH and YEAR functions in your SELECT statement.
- 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.
- SQLSTATE[42S22]: Column not found: 1054 Unknown columnPHP
It looks like you are encountering an error with the message "SQLSTATE[42S22]: Column not found: 1054 Unknown column".
- SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'PHP
This error message typically indicates that the MySQL server is unable to authenticate the user 'root'@'localhost' with the provided password.