。
$query = mysql_query("SELECT COUNT(*) as `box.id`
from boxes as box
left join page_boxes as pbox
on box.id=pbox.bid
left join page_subcribers as pages
on pages.page_id=pbox.page_id
left join category_boxes as cbox
on box.id=cbox.bid
left join subcribers as catsb
on cbox.category_id=catsb.cid
where pages.uid='".$session_id."' or catsb.uid='".$session_id."'
and box.status='".$approval."'")or die (mysql_error());
$row = mysql_fetch_array($query);
$total = $row['id'];
我需要box.id
作为此查询的索引$total = $row['id'];
,但当我使用此$total = $row['id'];
时,我会收到错误
Notice: Undefined index: id in C:\xampp\htdocs\media\ctrx.php on line 12
我怎样才能获得这个索引id值?
答案 0 :(得分:1)
我认为这将是$total = $row['box.id'];
答案 1 :(得分:0)
只需删除反引号
$query = mysql_query("SELECT COUNT(*) as box.id
或者您可以使用这样的反复使用
$query = mysql_query("SELECT COUNT(*) as `box`.`id`
但不包括表和列以及反引号
`box.id` // <---this wrong