这是我的代码。我的代码中有错误是 -
Warning: mysql_fetch_array() expects parameter 1 to be resource
...请解决它
我只想从id获取调用状态,这是从我的表中的存储过程获取的。
<?php
echo "Result from SP procOutput_sum:::::$SP_VAL";
$mysqli = mysql_connect("localhost", "root", "", "call_conference");
if (!$mysqli) {
die('Could not connect: ' . mysql_error());
}
?>
<?php
$select="select call_status from tbl_call_origin where id='$SP_VAL'";
while ($row = mysql_fetch_array($select)){
echo 'Status: '.$row['call_status'];
}
?>
答案 0 :(得分:1)
您缺少mysql_query
函数来获取$select
并返回$result
以传递给mysql_fetch_array
。
$select="select call_status from tbl_call_origin where id='$SP_VAL'";
$result = mysql_query($select);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
...
}
答案 1 :(得分:0)
<?php
echo "Result from SP procOutput_sum:::::$SP_VAL";
$mysqli = mysql_connect("localhost", "root", "", "call_conference");
if (!$mysqli) {
die('Could not connect: ' . mysql_error());
}
?>
<?php
$select="select call_status from tbl_call_origin where id='$SP_VAL'";
$results = mysql_query($select);
while ($row = mysql_fetch_array($results)){
echo 'Status: '.$row['call_status'];
}
?>