Reputation: 6887
I have an ssh layer. From that i'm going to get data via mysql shell. But when i use where clause inside a select function. it says bellow error message
echo $ssh->exec("mysql -ppass -u root xxxx -e 'select * from `student_master` where `SM_ID` =802350570V'");
This is says
ERROR 1054 (42S22) at line 1: Unknown column '802350570V' in 'where clause'
What's the issue?
Upvotes: 1
Views: 884
Reputation: 3855
Here, you are passing your query as an argument so wrap query with'
, but make sure that you add escape sequence to wrap query with'
You should use "
to wrap column value which is not of type int
.
Please try following:
`echo $ssh->exec("mysql -ppass -u root xxxx_col-b -e 'select * from student_master where SM_ID =\"802350570V\"'");`
Upvotes: 2
Reputation: 8451
You don't have single quote ('
) in your SM_ID = 802350570V'
. It should be like this:
echo $ssh->exec("mysql -ppass -u root esoftcar_col-b -e 'select * from `student_master` where `SM_ID` = \"802350570V\"'");
Upvotes: 2