Estoy intentando insertar un registro en MySQL usando PDO, mi sentencia sql se puede ver en el siguiente código.SQLSTATE [42S22]: Columna no encontrada: 1054 Columna desconocida
<?php
try{
//include file myfunctions.php allows us to calls functions from it
include ("myfunctions.php");
//Assign function getConnection() from myfunctions.php to variable $db
$db = getConnection();
foreach($_POST['chk'] as $check_value)
{
$check = $check_value;
$fav = "channel/item [title = \"$check\"]";
$holidayDoc = simplexml_load_file('holidays.xml');
$favourites = $holidayDoc->xpath($fav);
foreach($favourites as $currentFav)
{
echo "{$currentFav->link}". "<br \>";
echo "{$currentFav->title}". "<br \>";
echo "{$currentFav->description}". "<br \>";
echo "{$currentFav->pubDate} ". "<br \>";
$sql = "INSERT INTO `saved_holidays` (`subscriberID`, `link`, `pubDate`, `title`, `description`)
VALUES (`John`, `$currentFav->link`, `$currentFav->pubDate`, `$currentFav->title`, `$currentFav->description`)";
$db->exec($sql);
$db = null;
}
}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
Cuando se ejecuta este código, me aparece el siguiente mensaje de error;
SQLSTATE [42S22]: La columna no encontrado: 1054 Desconocido columna 'John' en 'lista de campos'
Ésta es sin duda una solución simple a este problema, pero me parece que no puede verlo , ¿alguien puede señalarme en la dirección correcta?
Se aceptará en voz alta, gracias por el enlace interesante. –