如何在sql響應爲空的情況下向此代碼添加句柄?如何處理空的sql響應?
<?php
$userReferrals_query = sql_query("SELECT id as id2 FROM balances WHERE email = '$address'");
$id2 = fetch_assoc($userReferrals_query);
$userReferrals_query2 = sql_query("SELECT COUNT(*) AS referrals FROM balances WHERE referredby = '".$id2['id2']."'");
$referrals = fetch_assoc($userReferrals_query2);
?>
sql_query是什麼東西的包裝? – Drew