您好我从数据库获取值时遇到了问题:
$marka=$_POST['marka'];
$marka=$connection->quote($marka);
$id_marki=$connection->query('Select id from Model where nazwa='.$marka)->fetch();
echo $id_marki['id'];
回声没有告诉我什么。
答案 0 :(得分:0)
$connection->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$stmt = $connection->prepare('Select id from Model where nazwa=?');
$stmt->execute(array($_POST['marka']));
$id = $stmt->fetchColumn();
echo $id;