如何加入获取id并限制$ stmt

$per_page = 6;
      if (isset($_GET["page"]))
        $page = $_GET["page"];
      else
        $page = 1;
      $start_from = ($page-1) * $per_page;
      try {
        $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $stmt = $conn->prepare("SELECT * FROM stock LIMIT $start_from, $per_page");"

How to join these 2 $stmt?

        $stmt = $conn->prepare("SELECT * FROM stock where id=".$_GET['id'] );
        $stmt->execute();
        $result = $stmt->fetchAll();
      }
      catch(PDOException $e){
            echo "Error: " . $e->getMessage();
      }

I get an error:

Error: SQLSTATE[42000]: Syntax error or access violation: 1064

I would do it in this manner:

$id = $_GET['id'];
$stmt = $conn->prepare("SELECT * FROM stock WHERE id= '$id' LIMIT $start_from, $per_page");
$stmt->execute();