Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 mysql 查询,它以 JSON 格式返回数据。检查是否有 0 条记录并返回该事实的最佳方法是什么?
$row_num = mysql_num_rows($rslt); $data = array(); while ( $row = mysql_fetch_row($result) ) { $data[] = $row; } echo json_encode( $data );
$row_num = mysql_num_rows($rslt); $data = array(); while ( $row = mysql_fetch_row($result) ) { $data[] = $row; } if(!$data){ echo "This is the government. We have removed your database!"; } else { echo json_encode( $data ); }