Heim >Backend-Entwicklung >PHP-Tutorial >PHP怎么同时查询多个ID?
<?phpinclude 'include/cmsdj.conn.php'; $CD_ID=SafeRequest('id','get'); global $db; $sql='Select * from '.tname('dj').' where CD_ID='.$CD_ID.''; $row=$db->getrow($sql); $server=$db->getrow('select * from '.tname('server').' where CD_ID='.$row['CD_Server'].''); if($row){ $CD_Url=$row['CD_Url']; $playurl=$server['CD_Url'].$CD_Url; echo '<list><m src="'.$playurl.'" label="'.$row['CD_Name'].'"/></list>';}?>
in(5555,6666,1111)
in(5555,6666,1111)
上面的是查到两个表的,不会写啊
global $db;$ar=explode(',',$CD_ID);foreach($ar as $CD_ID){ $sql='Select * from '.tname('dj').' where CD_ID='.$CD_ID.''; $row=$db->getrow($sql); $server=$db->getrow('select * from '.tname('server').' where CD_ID='.$row['CD_Server'].''); if($row){ $CD_Url=$row['CD_Url']; $playurl=$server['CD_Url'].$CD_Url; echo '<list><m src="'.$playurl.'" label="'.$row['CD_Name'].'"/></list>';}}
PHP code
?
1234567891011
global $db; $ar=explode(',',$CD_ID); foreach($ar as $CD_ID){ $sql='Select * from '.tname('dj').' where CD_ID='.$CD_ID.''; $row=$db->getrow($sql); …… 谢谢了。怎么把那点给你啊?
PHP code
?
1234567891011
global $db; $ar=explode(',',$CD_ID); foreach($ar as $CD_ID){ $sql='Select * from '.tname('dj').' where CD_ID='.$CD_ID.''; $row=$db->getrow($sql); ……
这样得出来的结果是。链在一起的。。。
可以像下面这样分行显示吗?
echo '
'."\n";