#Sql Syntax error
1 messages · Page 1 of 1 (latest)
no, name is just a column
there is name and uuid (testing stuff)
And the best part is, that I am not even using MariaDB
u sure ur not using mariadb?
are you missing a ;
Yep
cuz the error says you are
SELECT * FROM players WHERE name='IkeVoodoo';
I have MySQL running
oh ;-;
lol
Still errors
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''players'' at line 1
try 'players'
just using SELECT * FROM ? WHERE ? = ?; and using setString
*It's not taking external input, dw
u cant use ? for columns
Can you even bind a table name?
java allows you to use a prepared statement to replace the ? with something
WHERE only works for the ID column
var statement = conn.prepareStatement("SELECT * FROM ? WHERE ? = ?;");
statement.setString(1, name);
statement.setString(2, column);
statement.setString(3, value);
no
this will
(as in: same error)
the above wont
nvm im wrong
var sql = "SELECT * FROM %s WHERE %s = ?;".formatted(name, where);
var statement = conn.prepareStatement(sql);
statement.setString(1, String.valueOf(where.getValue()));
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''players'' at line 1