Jump to content

Multiple mySQLi calls


TapeGun007
Go to solution Solved by Zane,

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.