php - Prepared Statements and updating multiple rows -


i new prepared statements , in process of transitioning project...

the last piece have transition piece have update multiple rows/records.

this seems work me... however, curious , wondering technique , sending sort of response (boolean or other) success or failure. thoughts? comments? suggestions?

function timeupdate($uid, $galarr, $timestamp) {     global $mysqli; //my connection set elsewhere (bad/good?)     $q = "update sometable set timestamp = ? galleryid = ? , uniid = ?";     $stmt = $mysqli->prepare($q);     $stmt->bind_param("iii", $timestamp, $gid, $uid);      foreach($galarr $value) {         $gid = $value[0];         if(!$stmt->execute()) {              throw new exception($stmt->error, $stmt->errno);         }     }     $stmt->close(); } 

thanks in advance. links, suggestions appreciate.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -