Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6329323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:38:24+00:00 2026-05-24T17:38:24+00:00

I got some problem with binding some parameters in MYSQL statement in php. It

  • 0

I got some problem with binding some parameters in MYSQL statement in php. It is throwing an error when count($posts) > 1 on the marked line below. Anyone who know what I’ve done wrong?
The error is: Call to a member function bind_param() on a non-object. It is also reporting comman out of sync?(on the marked line below)

<?php 

include '../../main/mainFunctions2.php';

$futurePosts = json_decode($_POST['futurePosts']);

$repeatSerie = null;
if(count($posts) > 1){

    //Get new repeatSeries
    $stmt = $mysqli->prepare("
    SELECT repeatSerie
    FROM timeSpaces_futurePosts
    ORDER BY repeatSerie DESC
    LIMIT 1
    ");
    $stmt->execute();
    $stmt->bind_result($repeatSerie);
    $stmt->fetch();
    $repeatSerie = ((int)$repeatSerie + 1);
}
$timeStamp = time();
foreach($posts as $fp){
    $title = $fp->title;
    $startDate = $fp->startDate;
    $endDate = $fp->endDate;
    $startTime = $fp->startTime;
    $endTime = $fp->endTime;
    $location = $fp->location;
    $latLong = $fp->latLong;
    $info = $fp->info;
    $photoId = $fp->photoId;
    $invited = $fp->invited;
    if($invited != null){
        $invited = 1;
    }else{
        $invited = 0;
    }
    $reminderType = $fp->reminderType;
    $reminderTimeStamp = $fp->reminderTimeStamp;
    $repeatSerie = $repeatSerie;

    $stmt = $mysqli->prepare("
    INSERT INTO futurePosts (profileId, title, startDate, endDate, startTime, endTime, location, latLong, info, photoId, invited, reminderType, reminderTimeStamp, repeatSerie)
    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
    );
    $stmt->bind_param('isssiisssiisii', $profileId, $title, $startDate, $endDate, $startTime, $endTime, $location, $latLong, $info, $photoId, $invited, $reminderType, $reminderTimeStamp, $repeatSerie);
    //The line above: Call to a member function bind_param() on a non-object
    $stmt->execute();
    $futurePostId = $mysqli->insert_id;

    if($invited == 1){
        foreach($fp->invited as $friendsId){
            $friendsId = $friendsId;
            $stmt = $mysqli->prepare('
            INSERT INTO futurePosts_invited (profileId, futurePostId, timeStamp)
            VALUES (?, ?, ?)
            ');
            $stmt->bind_param('iii', $friendsId, $futurePostId, $timeStamp);
            $stmt->execute();
        }
    }
}

echo 'TRUE';


?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:38:25+00:00Added an answer on May 24, 2026 at 5:38 pm

    This is most likely because $stmt = $mysqli->prepare(...); line fails due to SQL syntax error. Try echoing $mysqli->error to see what’s wrong with it.

    Try calling $stmt->store_result(); after execution of your SELECT statement and before issuing any other queries to MySQL.

    Side note: you should prepare your statement before foreach loop. That will get you a bit of performance gain, since the statement will only be compiled once and only parameters will be sent to server on each loop run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some problem with using jQuery HTML <div class=dnone team_data id=team_<?php echo $allnum;
I have some problem with Jquery Autocomplete plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ ) I got it
I've got some tabs. http://img196.imageshack.us/img196/7167/tabs.gif And I want to add a rollover effect. Problem
I've got a K-nearest neighbour problem where some of the dimensions are closed loops.
I've got following problem: (c#) There is some class (IRC bot), which has method,
Got a math calculation problem. $a = 34.56 $b = 34.55 $a do some
i`ve got a little problem with LINQ. I read out some information via XML-RPC.
I've got stuck in a problem with gflags when trying to find some memory
I've got a problem on a WebForms application where a user selects some criteria
I've got a quite strange problem here. I'm calling some simple code via Ajax.Updater:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.