<?php include 'connection.php';
session_start();
$sqls ="SELECT * FROM markus WHERE user= :c AND id=:id";
$result= $handle->prepare($sqls);
$result->bindParam(':c',$_COOKIE['john'],PDO::PARAM_STR);
$result->bindParam(':id', $_POST['id'],PDO::PARAM_INT);
$resullt execute ();
$row = $result->fetchAll(PDO::FETCH_ASSOC);
if(!($row)){– if (!isset($_POST['submit']) && $_POST['r'] <= 5 )
{ $sql_1 = "INSERT INTO markus (bo,us,r,rng) VALUES(:bo,:us,:r,:rng)"; $query = $handle->prepare ($sql_1); $params = array(':bo'=> $_POST['bo'],':us'=> $_POST['us'],':r'=> $_POST ['r'],':rng'=> $_POST['rng']);
$query -> execute($params); echo success }
else { echo nope } } ?>
this is the code i have at present so please help me guys ?????
You have a placeholder in your query named ":john", this means that you have to fill this placeholder with a correct value, before proceeding, using the "bindParam()" method of your PDO instance.
$sqls =$handle->prepare("SELECT * FROM john WHERE user= :cookieJohn AND book_id=:john");
//This lines right under here
$sqls->bindParam(':cookieJohn',$_COOKIE['john']);
$sqls->bindValue(':john',1,PDO::PARAM_INT);
$sqls->execute();
$row = $sqls -> fetch();