PHP/MySQL : Unsure why variable does not contain a value

标签 php mysql

有人能解释一下为什么这段代码没有为 $consultant 输出值吗 当数据库如下:

enter image description here

下面是代码...

<?php include ("include/config.php");


$SUC = mysql_query("

    SELECT `decisionValue` FROM `teamdecision` WHERE `decisionType` = 'SUconsultant'

")or die($SUC."<br/><br/>".mysql_error());

$SUNumR  = mysql_num_rows($SUC);
$consultant = array();

$i="0";

while ($i<$SUNumR && $row = mysql_fetch_assoc($SUC))
{

    $consultant[$i] = $row['SUconsultant'];
    echo $consultant[$i];
    $i++;

}
?>

谢谢

最佳答案

不应该是$consultant[$i] = $row['decisionValue'];吗?

关于PHP/MySQL : Unsure why variable does not contain a value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9057021/

相关文章:

php - 如何在mysql中使用别名变量作为条件?

php - cURL 请求挂起浏览器并继续在 Cpanel 上等待

联系人的 Mysql 语法错误

javascript - 使用服务器发送事件的基于 Php 的查询实时聊天。(多对一系统不是群聊)

使用 GAE 云 sql 更新 PHP mySQL

mysql - Mysql发现死锁

mysql - 为什么这个 View 不能正确求和?

按时间分组的 MySQL 查询

php - 用户名和通过mysql数据库登录

PHP 同时更新两个表