php - Sql returns empty row on combinning primary key with another value in where clause -


i getting empty row on following sql

select * flyers fid='6' , 'userid'='400'  

mysql returned empty result set

(i.e. 0 rows). (query took 0.0004 sec) 

but when use

select * flyers fid='6' 

showing rows

0 - 0 (1 total, query took 0.0005 sec). 

as got result , correct using primary key.

but not know why mysql returns empty row on using , primary key.

note:- fid flyer table primary key.

hi in query have 1 mistake used single quotes around uerid use back ticks instead or nothing.

select * flyers fid='6' , userid='400'    select * flyers fid=6 , userid=400// safe not use quotes 

but suggest not use quotes around numbers below reason

real issue comes down type casting. when put numbers inside quotes, treated string , mysql must convert number before can execute query. while may take small amount of time, real problems start occur when mysql doesn't job of converting string. example, mysql convert basic strings '123' integer 123, convert larger numbers, '18015376320243459', floating point. since floating point can rounded, queries may return inconsistent results


Comments