简体   繁体   中英

selecting more than 1 table to get content from [php/Mysql]

i want to get the latest threads/messages i made my code then i made function that calls the code to show last messages in specific board it works great now i want to get latest messages from 2 boards or more in the same function this is the part that chooses the board

     AND b.id_board = t.id_board' . (empty($vars) ? '' : '
     AND b.id_board = ' . $vars . ''). '

i tried to use functionname(1.2.3); but he says no board with id 1.2.3 i tried ("1,2,3") same i wish i made it clear for you i apreciate your help

I think instead of b.id_board = ' . $vars . ' b.id_board = ' . $vars . ' b.id_board = ' . $vars . ' you need b.id_board in (' . $vars . ') , then $var would be a comma separated list of ids as a string "1,2,3" . (leaving all security issues aside :) )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM