$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