Jump to content

Multiple mySQLi calls


TapeGun007

Recommended Posts

I have a typical prepared mySQLi statement that runs just fine for example:

 

...
$stmt = $con->prepare($sql);
    if($stmt === false){
        trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $con->error, E_USER_ERROR);
    }
    $stmt->bind_param("s",$Username);
 
    $stmt->execute();
 
    $stmt->bind_result( ** Variables here** );
    $stmt->fetch();
    $stmt->close();

 

This all works fine.  Now I want to make another mySQLi call using a function basically.  The function works FINE in a test file with no other mySQLi calls in it.  For sake of ease, just assume this was actually in the code after the above.

 

 

$sql="INSERT INTO LoginAttempts (LASalesID) VALUES ('$ID')";
        if ($con->query($sql) === TRUE) {
            echo "New record created successfully";
        } else {
            // Report the Error
            echo "Error: " . $sql . "<br>" . mysqli_error($con);
        }

 

I'm getting the Error message every time.  Am I not closing out the initial calls correctly and freeing up resources?  

Link to comment
https://forums.phpfreaks.com/topic/297549-multiple-mysqli-calls/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.