Sql injection work but have allitle problem [duplicate] - html

This question already has answers here:
using (-) dash in mysql table name
(2 answers)
Closed 9 months ago.
username:admintest
password:' or 1=1#
(and it works perfectly)
But here is the problem
username:a-dmintest
password:' or 1=1#
(and it doesnt work)
when the username have a dash it don't work
Why ?

Maybe you just dont have a user called "a-dmintest"
The dash is not a operator in SQL

Related

REGEXP in MYSQL isn't working for full word search all time [duplicate]

This question already has answers here:
What special characters must be escaped in regular expressions?
(13 answers)
What is a word boundary in regex?
(13 answers)
Closed 2 years ago.
I've a table like this,
values
-------------------
male,female
PHP 30
PHP (30)
PHP ($30),CSS ($20)
PHP {$30},CSS {$20}
PHP [$30],CSS [$20]
PHP (€30),CSS (20)
I've prepared the sql like this,
SELECT mytable.values FROM mytable WHERE mytable.values REGEXP '[[:<:]]PHP ($30)[[:>:]]'
It should match one row (4th), but it's not working.
It's also not working with
() / {} / [] or any types of symbols like $ / €
I want to mention here that,
MYSQL LIKE isn't the right thing for me I think, because it won't work if we want to match male.
REGEXP is working for PHP 30 here and it's working for only strings.
Could anyone please inform me what will be the best solution to match the exact word or sentence?
Thanks in advance.

MySQL invalid repetition count(s)' from regexp [duplicate]

This question already has answers here:
Got error 'invalid repetition count(s)' from regexp
(1 answer)
MySql Regex Expression test
(1 answer)
Closed 5 years ago.
I'm having an issue with a query I'm running on MySQL that contains some regex, here it is: SELECT * FROM dump WHERE Hours REGEXP '^\d{337}1{8}'
When I test my regex separately it's working fine, here's some sample data that it matches with:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111100000000
Any idea where it fails?

how to take first 3 character from a string using PHP [duplicate]

This question already has answers here:
MySQL Select Query - Get only first 10 characters of a value
(3 answers)
Truncate a string to first n characters of a string and add three dots if any characters are removed
(20 answers)
Closed 6 years ago.
I need to take only three characters from the string stored in MYSQL and output must be the first 3 character and the login date of customer
I am beginner kindly help me to code in PHP.
SELECT LEFT(string , 3) , logindate FROM tbl;
Hope this will help you.

SQL quoting error [duplicate]

This question already has answers here:
When to use single quotes, double quotes, and backticks in MySQL
(13 answers)
Closed 7 years ago.
I want to create a table using this Syntax
MySQL
But then as you can see, there's a red underline on "text".
I have tried using text.'tblemployee', 'text.tblemployee' , etc.
None of them worked.
Am I missing something here?
p.s : this is my first post ever, sorry if it is not really descriptive, Cheers.
Please replace the symbol apostrophe(') with the back quote(`)

why won't mySQL let me SET return=1? [duplicate]

This question already has an answer here:
Syntax error due to using a reserved word as a table or column name in MySQL
(1 answer)
Closed 7 years ago.
It makes no sense. I have a TINYINT field that is either 0 or 1 and I'm trying to set it like this:
UPDATE db_products SET return='1' WHERE product_id=342343434
But it tells me there's a mySQL syntax error. What am I doing wrong here? Is the problem that the field is called return? If so, how do I get around it without changing it?
In most cases, you can get around reserved word problems by enclosing with "ticks"; the quote-like thing that usually shares the ~ key.
UPDATE db_products SET `return`='1' WHERE product_id=342343434