setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// prepare sql and bind parameters
$stmt = $dbConnection->prepare("INSERT INTO cwsvjudo.nachrichtenDev (datum, betreff, nachricht, autor, promoImg) VALUES (:datum, :betreff, :nachricht, :autor, :promoImg)");
$stmt->bindParam(':datum', $newsArticle['datum']);
$stmt->bindParam(':betreff', iconv("UTF-8", "ISO-8859-1", $newsArticle['betreff']));
$stmt->bindParam(':nachricht', iconv("UTF-8", "ISO-8859-1", $Parsedown->text( $newsArticle['text'] )));
$stmt->bindParam(':autor', $newsArticle['autor']);
$stmt->bindParam(':promoImg', json_encode( $newsArticle['promoImg'] ) );
// insert a row
$stmt->execute();
echo "New records created successfully";
}
catch(PDOException $e){
echo "Error: " . $e->getMessage();
}
$dbConnection = null;
}
}
?>
Nachrichtenadministration
$newsArticle['datum'],
'betreff' => $newsArticle['betreff'],
// 'promoImg' => $newsArticle['promoImg']['url'],
'promoImg' => $newsArticle['promoImg'],
'nachricht' => Parsedown::instance()->text($newsArticle['text']),
'autor' => $newsArticle['autor']
)));?>
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$newsList = getNews($dbConnection, array('limit'=>6));
}
catch(PDOException $e){
echo "Error: " . $e->getMessage();
}
$dbConnection = null;
if(!empty($newsList))
foreach( $newsList as $news)
echo("
".getHtmlNews($news));
else echo("Keine Nachrichten gefunden!")
?>