示例#1
0
/**
 * Schreibe neue DB-Einträge.
 *
 * @param $jsonData
 * @param $db
 * @param $datum
 *
 * @return bool (true|false)
 */
function writeDB($jsonData, $db, $datum)
{
    $checkCount = count($jsonData["podcasts"]) - 1;
    #echo '<pre>';
    #var_dump( $jsonData );
    #echo '</pre>';
    //Prüfe ob DB vorhanden und einen Eintrag hat.
    $newEntrysInDB = testDB($db, $checkCount);
    #var_dump( $newEntrysInDB );
    if ($newEntrysInDB == false) {
        $i = 0;
        // Lese Json aus und trage sie in DB ein.
        while ($i <= count($jsonData["podcasts"]) - 1) {
            $db->exec("INSERT INTO new\n                ('podcast','slug','url','nodetime', 'podbetime', 'ok')\n                VALUES\n                ( '" . $jsonData["podcasts"][$i]["name"] . "',\n                  '" . $jsonData["podcasts"][$i]["slug"] . "',\n                  '" . $jsonData["podcasts"][$i]["url"] . "',\n                  '" . $datum . "',\n                  '" . $jsonData["podcasts"][$i]["time"] . "',\n                  'i.A.'\n                )");
            $i++;
        }
        $out = true;
    } else {
        $out = false;
    }
    return $out;
}
示例#2
0
<?php

include "init.php";
?>
<html>
	<head>
		<title>Roexian's projects page</title>		
	</head>
	<body>
		<div>
			My page is dedicated to the learning and understanding of web programming and other ideas. In the future I hope let this serve as a blog and a repository of accumulated knowledge.
            <br />
            <br />
            	<?php 
testDB();
?>
		</div>
	</body>
</html>