0

When I run this function the if part gets executed, meaning that statement has some error.

public function retweet($tweet_id,$user_id,$get_id,$comment)
    {

        $stmt=$this->pdo->prepare("INSERT INTO `tweets` (`status`,`tweetBy`,`tweetimage`,`retweetID`,`retweetBy`,`postedOn`,`likesCount`,`retweetMsg`) SELECT `status`,`tweetBy`,`tweetImage`,`tweetID`,:user_id,CURRENT_TIMESTAMP,`likesCount`,`retweetCount`,:retweetMsg FROM `tweets` WHERE `tweetID` = :tweet_id");
        $stmt->bindParam(":user_id",$user_id,PDO::PARAM_INT);
        $stmt->bindParam(":retweetMsg",$comment,PDO::PARAM_STR);
        $stmt->bindParam(":tweet_id",$tweet_id,PDO::PARAM_INT);
        $stmt->execute();
        if (!$stmt->execute()) {
            echo "failed to connect";
        }
    }
Sangwin Gawande
  • 7,658
  • 8
  • 48
  • 66

0 Answers0