显示一组db行的一个结果 [英] display one result from a set of db rows
问题描述
朋友们,我正在制作两张桌子。一个表(A)存储另一个表(B)的ID。
我将id存储在表中。使用相应的''id'',我必须得到表B中给出的值。[php]<?php
$ query =''SELECT * FROM jos_domain where userid =''。 $ _SESSION [''userid''];
$ db-> setQuery($ query);
$ rows = $ db-> loadObjectList();
foreach($行为$ row)
{
$ level = $ row-> lenglish_id;
$ db-> setQuery(" SELECT * FROM jos_elevel where id = $ level");
$ rows = $ db-> loadObjectList();
foreach($行为$ row){echo $ row-> english;
echo"," ;;
}
?>
< / td>
< / tr> [/ php]显示的输出有2, 3,4
i希望输出显示只有2
当我请求行[1]时我需要显示其对应的值。 />
然后必须显示3,然后必须显示4。
任何人都可以告诉如何获得单个值,即只需要显示2个。<当被要求它时,
必须显示值3。怎么样 ? PLZ。提前谢谢。
问候,
ramu
query =''SELECT * FROM jos_domain其中userid =''。
_SESSION [''userid''];
db-> setQuery(
Hi friends, I am working on two tables. one table(A) stores id of another table(B).
I store id''s in the table. with that corresponding ''id'' ,i have to get the value given in table B. [php]<?php
$query = ''SELECT * FROM jos_domain where userid=''. $_SESSION[''userid''];
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row)
{
$level= $row->lenglish_id;
$db->setQuery("SELECT * FROM jos_elevel where id= $level");
$rows = $db->loadObjectList();
foreach ($rows as $row) { echo $row->english;
echo ",";
}
?>
</td>
</tr>[/php]the ouput is displayed has 2,3,4
i want output to be displayed has only 2
and when i request for rows[1] i need to display its corresponding value.
then 3 has to displayed and then 4 has to be displayed.
can anybody tell how to get a single value i.e., only 2 has to be displayed .
when asked for it has to display value 3 . How ? plz. thanks in advance.
regards,
ramu
query = ''SELECT * FROM jos_domain where userid=''.
_SESSION[''userid''];
db->setQuery(
这篇关于显示一组db行的一个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!