MySQL Forums
Forum List  »  PHP

Re: Update mySQL row with PHP using sproc
Posted by: Peter Brawley
Date: June 15, 2020 12:14PM

The code you showed for processing the multi_query() call looks insufficient, the model is ...
if( $res ) {
  $results = 0;
  do {
    if ($result = $mysqli->store_result()) {       // STORE RESULT
      printf( "Result #%u:", ++$results );
      echo nl2br("\n"};
      while( $row = $result->fetch_row() ) {       // FETCH RESULT
        foreach( $row as $cell ) echo $cell, " ";
      }
      $result->close();                            // CLOSE RESULT
      if( $mysqli->more_results() ) echo nl2br("\n");
    }
  } while( $mysqli->next_result() );               // NEXT RESULT
}
$mysqli->close();

> $personId = $mysqli -> real_escape_string($_REQUEST['personId']);

Your script had named the connection var $conn not $mysqli.

> $personId = $mysqli_real_escape_string($_REQUEST['personId']);

Lose the $ at the beginning of the func name, check the PHP manual for mysqli_real_escape_string() syntax ... first param is connection param.



Edited 2 time(s). Last edit at 06/15/2020 12:48PM by Peter Brawley.

Options: ReplyQuote




Sorry, only registered users may post in this forum.

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.