[EDIT]
I have a problem with connecting the postgresql database using php to the html page in such a way that the connection could send back and forth. I need to get specific values from the database and display them in the form of a pie chart (preferably like with charts.js) I tried to do it on localhost in windows (necessary requirement). I run php and html on xampp, base supports pgadmin4. I changed ;extension=pdo_pgsql to extension=pdo_pgsql BUT now the error is this:
Warning: pg_query(): Query failed: ERROR: column "nazwa" relacji "tabelka1" does not exist LINE 1: INSERT INTO tabelka1(Nazwa, Opis, ID, Wartość) VALUES('fajna... ^ in C:\xampp\htdocs\DG\1\add.php on line 12 Error with query: ERROR: column "nazwa" relacji "tabelka1" does not exist LINE 1: INSERT INTO tabelka1(Nazwa, Opis, ID, Wartość) VALUES('fajna... ^
BUT WAIT! The column exists!
https://i.stack.imgur.com/6hazn.jpg
I'm so confused right now... what am I supposed to do? Please be patient and try explain me step by step if anyone can...
<html>
<body>
<?php
$db = pg_connect('host=localhost port=5432 dbname=test1 user=postgres password=jajuszko123');
$ID = pg_escape_string($_POST['ID']);
$nazwa = pg_escape_string($_POST['nazwa']);
$Opis = pg_escape_string($_POST['Opis']);
$Wartość = pg_escape_string($_POST['Wartość']);
$query = "INSERT INTO tabelka1(ID, Nazwa, Opis, Wartość) VALUES('" . $ID . "', '" . $nazwa . "', '" . $Opis . "', '" . $Wartość . "')";
$result = pg_query($db,$query);
if (!$result) {
$errormessage = pg_last_error();
echo "Error with query: " . $errormessage;
exit();
}
printf ("These values were inserted into the database - %s %s %s", $ID, $nazwa, $Opis, $Wartość);
pg_close();
?>
</body>
</html>
I expect to get data values from my database and display it on html file.