Answer the question
In order to leave comments, you need to log in
How to display values with all id's from a PostgeSQL table?
It produces the following error:
<html>
<head>
<title>МОАТП</title>
</head>
<body>
<?php echo '<p>Коннектимся к базе PostgreSQL:</p>'; ?>
<?php
// Соединение, выбор базы данных
$dbconn = pg_connect("host=pg.sweb.ru port=5432 dbname=moatpru_test user=moatpru_test password=*od***obe**anj*")
or die('Could not connect: ' . pg_last_error());
var_dump($dbconn);
echo '<p>Выполняем SQL запрос:</p>';
$table= "Users";
// generate and execute a query
$query = "SELECT id FROM $table";
$result = pg_query($connection, "SELECT users FROM $table") or die("Error in query: $query.
" . pg_last_error($connection));
// get the number of rows in the resultset
$rows = pg_num_rows($result);
echo "There are currently $rows records in the database.";
// close database connection
pg_close($connection);
?>
<?php echo '<p>FINISH</p>'; ?>
Answer the question
In order to leave comments, you need to log in
You deleted the previous question and I have no desire to type the answer again. Therefore, I will be brief.
One error was pointed out by Rsa97 , the second error:
SELECT id FROM Users;
SELECT id FROM "Users";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question