1
    ( ! ) SCREAM: Error suppression ignored for
    ( ! ) Notice: Undefined index: q_sold in C:\wamp\www\aaa\mup.php on line 93
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0039  144192  {main}( )   ..\mup.php:0

我得到了这段代码的未定义索引:

<table align="center" border="2">
   <tr>
    <td align="center"> <font color="">  Quantity Sold:</td>
    <td align="center"> <font color="">  Month:</td>
   </tr>

<?php
include 'connect.php';


$bogart=mysqli_query($con," SELECT  `month`, sum(q_sold) as sold_sum
FROM  `samsung_store` group by `month` order by sold_sum desc
LIMIT 1 ") or die (mysql_error());

$count=mysqli_num_rows($bogart);

while($baragan=mysqli_fetch_array($bogart)){

if($count % 2 == 0){
$color="#EDEDED";
$count--;
}
else{
$color="white";
$count--;
}
?>

 <tr bgcolor="<?php echo $color?>">
      <td> <?php echo $baragan['q_sold']?></td>
      <td> <?php echo $baragan['month'] ?></td>
    </tr>

<?php
}
?>

</form>
</table>

我只需要删除错误。我不知道我如何尝试在开头加上“@”符号:但没有用

$bogart=msqli_query

对不起,我是初学者,请裸露。谢谢。

4

1 回答 1

5
<td> <?php echo $baragan['q_sold']?></td>

q_sold当您在查询中选择名为的别名时,为什么要访问索引sold_sum

将其更改为:

<td> <?php echo $baragan['sold_sum']?></td>

提示:print_r($baragan);用于查看这里出了什么问题。

于 2013-06-18T14:35:18.410 回答