This query matches correctly what im after:
$sql = $pdo->query('SELECT ssn FROM doge WHERE first_name = "Anne-Christine"');
however when i write it like this, it gives me "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Anne' in 'where clause'":
$namn = "Anne-Christine";
$sql = $pdo->query('SELECT ssn FROM doge WHERE first_name = '. $namn .'');
this query gives me no result with no failures being printed:
$namn = "Anne-Christine";
$sql = $pdo->query('SELECT ssn FROM doge WHERE first_name = ". $namn ."');
same with this query:
$sql = $pdo->prepare('SELECT ssn FROM doge WHERE :first_name = first_name');
$query->execute(array(
':first_name' => $namn
));
the last two queries also crashes the page and dont write out any more code. ive asked 3 of my friends and none of them can find the fault, nor can i. what am i doing wrong?