Salut,
Je suis debutant sous PHP et suite au scprit suivant :
Voici la reponse :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <?php $connection = pg_connect("host=nom_serveur port=5432 dbname= my_db user=postgres password=my_password") or die ("Pas pu me connecter à my_db--> " . pg_last_error($conn)); $result=pg_exec("SELECT area FROM My_table WHERE AREA > 1000"); // Sample of SQL QUERY if (!$result) { echo "An error occured.\n"; exit; } while ($row = pg_fetch_row($result, $i)) { for ($j=0; $j < count($row); $j++) { echo "$row[$j] "; } echo "<BR>"; } pg_close($connection); // Close this connection ?>
Pas pu me connecter à my_db -->Warning: pg_connect() unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "mon_serveur "and accepting TCP/IP connections on port 5432? in /usr/local/apache/htdocs/phpPgAdmin/test/my_db.php on line 2
Warning: pg_last_error(): supplied argument is not a valid PostgreSQL link resource in /usr/local/apache/htdocs/phpPgAdmin/test/my_db.php on line 3
Je travaille sur une machine distante, celle sur laquelle je tente de me connecter, alors q'une connexion SSH - psql fonctionne.
Merci de votre aide.
Modéré par Stessy
Ajout de balises
Prière de lire les règles du forum
Merci
Partager