Credo che il secondo errore:
Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given

Me lo dia perche non eseguo la query