prepared-statement
Is it possible to use (with PHP) prepared statements that have been previously declared in the mysql CLI?
In the mysql CLI I have prepared a statement like this:
How to improve the workaround in PHP for large encrypted databases using AES_ENCRYPT with PDO prepared statements?
Using prepared statements in MySQL you have to use a parameter only once.
Coding like the example below will envoke “SQLSTATE[HY093]: Invalid parameter number”
Error SQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘?)INSERT INTO Clientes(nome) VALUES(?)’ at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:768)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:653)
at uni.jdbc.preparedStatement.Main.main(Main.java:46)
MariaDB: No database selected error on some query
I have a php code that rise a query against a MariaDB (using MariaDB 10.5.11 on debian 11) table; I use php-mysql prepared queries for this task as reported in the code below:
Repeat query when conditions aren’t met
I am making a kindof quiz. The quiz has 15 questions, for the quiz I need 5 questions of quiztype ‘1’, 5 of quizType ‘2’ and 5 of quizType ‘3’. Right now I’m counting quiztype ‘1’and quiztype ‘2’ trough a loop and if conditions outside the loop aren’t met, I get 15 new entry’s and repeat the loop. I’m wondering, is there a better way to do this inside my query instead of using 2 objects?
This Is my code:
query to array show all values 2 times
I want to put the query into an array, but I’m having troubles with the array.
This is my code:
How can i grant execute on a prepared statment to an user?
I have to execute a prepared statment in workbench, logining as an user who doesn’t have privileges:
How can I add prepare statement in my comment printing system
I’m currently building a system where users can write and read comments. So the comments will be inserted into database (the inserting part is already protected with the prepared statement), so now I want to add the prepared statement at the comment printing part too.
What is the workaround if group_concat doesn’t return a value
I have written a query which transforms a couple of rows based on a condition into columns.