change to SQL
This commit is contained in:
parent
0e5864370f
commit
973e5da155
|
@ -23,13 +23,15 @@ if (!$link) {
|
||||||
die('Could not connect to Database: ' . mysql_error());
|
die('Could not connect to Database: ' . mysql_error());
|
||||||
}
|
}
|
||||||
//if connection is successfully you will see message below
|
//if connection is successfully you will see message below
|
||||||
echo 'Connected successfully to Database';
|
echo 'Connected successfully to Database<br>';
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
//$mysqli = new mysqli($databaseAddress, $databaseUser, $databasePassword, $databaseName);
|
//$mysqli = new mysqli($databaseAddress, $databaseUser, $databasePassword, $databaseName);
|
||||||
|
|
||||||
function saveToDatabase($contentArray, $mysqli) {
|
function saveToDatabase($contentArray, $mysqli) {
|
||||||
|
echo "sending Query to Database<br>";
|
||||||
$response = mysqli_query($mysqli, "INSERT INTO `topics` (`id`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ($contentArray[0], $contentArray[2], $contentArray[3], $contentArray[4], $contentArray[5], $contentArray[6], $contentArray[7], $contentArray[8]) ON DUPLICATE KEY UPDATE `id` = $contentArray[0]");
|
$response = mysqli_query($mysqli, "INSERT INTO `topics` (`id`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ($contentArray[0], $contentArray[2], $contentArray[3], $contentArray[4], $contentArray[5], $contentArray[6], $contentArray[7], $contentArray[8]) ON DUPLICATE KEY UPDATE `id` = $contentArray[0]");
|
||||||
|
echo "Query sent<br>";
|
||||||
echo $response;
|
echo $response;
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue