Answer the question
In order to leave comments, you need to log in
Whence the error at SQL request undertook?
try {
$dsn = "mysql:host=localhost;dbname=main";
$opt = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
);
$DBH = new PDO($dsn, "root", "pass", $opt);
$STH = $DBH->prepare("INSERT INTO users (username, date) VALUES(smellyshovel,5)");
$STH->execute();
$answer = $STH->fetch();
print $answer;
} catch(PDOException $e) {
print($e->getMessage());
}
$DBH = null;
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'smellyshovel' in 'field list'
Answer the question
In order to leave comments, you need to log in
Column not found : 1054 Unknown column 'smellyshovel' in 'field list'
check the database for fields or the correct field name in the query.
where does $what come from? there is a feeling that it was there that "smellyshovel" turned out to be, it is not clear why the truth is, because this error is explicit when trying to execute select.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question