MySQL Forums
Forum List  »  PHP

Re: Local database can read and online can't
Posted by: Peter Brawley
Date: December 07, 2019 08:06PM

> $item = mysqli_fetch_array(mysqli_query($conn, "SELECT `Flasche` FROM flaschen500 WHERE ID=" . $id . ""))["Flasche"];

Unsound---when mysqli_query() or mysqli_fetch() fails, you need the error info ...

$res = mysqli_query( $conn, "SELECT `Flasche` FROM flaschen500 WHERE ID=$id" );
if( $res ) {
  If( $row = mysqli_fetch_array($res) )
    echo $row["Flasche"];
  else echo mysqli_error( $conn ) ;
}
else 
  echo mysqli_error( $conn ) ;



Edited 1 time(s). Last edit at 12/08/2019 11:13AM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
Re: Local database can read and online can't
December 07, 2019 08:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.