Can't create a view using the views module - mysql

I created a view using Views module based on the default node index. But the first thing I found is this error message:
SQLSTATE[42000]: Syntax error or access violation: 1064 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 '-1 OFFSET 0' at line 2
What might cause this and how do I solve it?

You have an error in your SQL syntax !
View module just GUI for create query
so you be sure your choice was Logical for create a query

Related

Cannot create tables through PopSQL - ER_PHRASE_ERROR

I'm completely new to SQL and trying to learn online. I'm trying to create tables in MySQL through PopSQL, but I keep getting a syntax error. Not sure what I'm doing wrong. Picture attached for reference. Any help will be appreciated.
My query is:
CREATE TABLE studentinfo ();
And the error I get when trying to run it is:
ER_PARSE_ERROR: 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 ')' at line 1
Link for reference

Yii2 querybuilder correct syntax for table names with raw sql

Can anyone tell me what is it that I am doing wrong in this statement
$connection = Yii::$app->db;
$result=$connection->createCommand("SHOW TABLE STATUS LIKE
{{%promo_deliveries}}")->execute();
I am getting this error
Exception 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax
error or access violation: 1064 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 'sms_promo_deliveries' at line 1 The
SQL being executed was: `SHOW TABLE STATUS LIKE sms_promo_deliveries'
in
F:\xampp\htdocs\Nxb\sms_protected\vendor\yiisoft\yii2\db\Schema.php:631
Error Info: Array (
[0] => 42000
[1] => 1064
[2] => 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 'sms_promo_deliveries' at line 1 )
This had nothing to do with the table naming convention when using query builder in fact it was a syntax error as specified, had to add quotes around the table name as i was using the LIKE keyword to match the table name.
$result=$connection->createCommand("SHOW TABLE STATUS LIKE
'{{%promo_deliveries}}'")->execute();

Mysql Collation does not work

I insert some text which i scrap from remote server and the problem is that in the text here is symbol.
� which makes a syntax error insert doe not work .Any ideas about this a
paradox????? I've tried almost all collation nothing works.Text is in armenian.
SQLSTATE[42000]: Syntax error or access violation: 1064 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 '
ՄԱԿ-ի գլխավոր քա�' at line 1
Thanks in advance
FIXED..!!!The problem was when create an instance of PDO I didn't mention this part
charset=utf8

Can't find out what's wrong with this MySQL event syntax

I'm trying to create a MySQL event, and this is the syntax I'm using:
CREATE EVENT test
ON SCHEDULE AT FROM_UNIXTIME(1428005286)
DO
BEGIN
UPDATE blog_posts SET status = 'published' WHERE id = 5;
END
When I run it on Node.js (with the mySQL adapter, under Sails.js), I get no error, but the event doesn't get created. When I run it directly through phpMyAdmin, I get:
#1064 - 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 '' at line 5
I have also tried adding a semicolon to END, making it END;, and removing all semicolons, and it returns a slightly similar error:
#1064 - 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 'END' at line 6
I have no idea why this is happening. Any help is appreciated. Thanks.
You probably need to start with: create DEFINER=root#localhost ...
Also, since this is a one-liner, you don't need BEGIN..END

MySQL Injection going wrong

I was testing security of a friend's site and I found SQL Injection vulnerability by putting ' at end of URL
The site is built in zend framework
The issue I am having is the comment syntax in MySQL -- is not working so the page is still throwing error
Exception: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'order by 1--) ORDER BY companies.company_name ASC' at line 8
in /home/xxxxxxx/xxxxxxxxxx/lib/Zend/Db/Adapter/Abstract.php on line 157
If you look up the error, the query is not terminated after --
Even # and --+-is not working
By putting ' at the end of the URL and the website is throwing out an error doesn't always mean it's vulnerable against SQLi.