您好我使用ssp clas作为数据表。
function prod($a){
$query= mysql_query("SELECT name FROM products WHERE sipid = '$a'");
while($row = mysql_fetch_array($query)){
return $row[name];
}
}
Ssp.class.php
array(
'db' => 'id',
'dt' => 5,
'formatter' => function( $d, $row ) {
return prod($d);
}
)
我在数据库中有两行,但这只显示一行?
答案 0 :(得分:1)
返回
后不会执行任何语句你回来了
while($row = mysql_fetch_array($query)){
return $row[name];// this is wrong
}
将其更改为
$name = array();
while($row = mysql_fetch_array($query)){
$name[] = $row[name];// assign to array
}
return $name;// <--- return here.
同时切换为mysqli_*
或PDO
,因为mysql_*
已被弃用。