query($sql_string); $error = $dbs->error; if ($error) { die('SQL ERROR : '.$error.''); } if ($query->num_rows > 0) { while ($row = $query->fetch_row()) { echo ''.$row[2].' - '.$row[1].''."\n"; } } else { // output the SQL string // echo ''.$sql_string.''; echo 'NO DATA FOUND'; }