php - mysql - return all dogs from animal_type column -


i don't know right way ask question.

lets assume have table animals. each row has information such average weight, native climate, , animal_type.

i want see rows animal_type dogs,cats,fish

i have array created lists each type, surrounded ' , separated , code line:

$sql = "select * mytable ({$want_to_see}) = 'animal_type'"; 

gets parsed into

select * mytable ('dogs','cats','fish') = 'animal_type'  

which yields

operand should contain 3 column(s)

on output webpage. going wrong?

presumably, animal_type column. if so, don't use single quotes.

and function want in():

$sql = "select * mytable animal_type in ({$want_to_see})"; 

only use single quotes string , date constants, never column aliases.

your specific error little inscrutable. happening tuple of 3 strings being compared single string. why error mentions 3 operands.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -