Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9211161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:13:58+00:00 2026-06-18T01:13:58+00:00

<?php $connect = pg_connect(dbname=$dbase host=.$host. user=.$user. password=.$pass) or die(I sense a disturbance in the

  • 0
<?php

$connect = pg_connect("dbname=$dbase host=".$host." user=".$user." password=".$pass) or die("I sense a disturbance in the force ");

$action = $_POST['action'];

switch($action){
case 'bagSubmit' : bagSubmit(); break;
}

function bagSubmit(){
    $sql = 'SELECT * FROM cntrt';
    $query = pg_query($connect,$sql) or die('could not connect');
}
?>

The above php returns ‘could not connect’. The sql query executes fine in the database. This is my normal procedure for executing queries in php (always worked before). The only difference now is that I am calling the php from jquery. The jquery is executing fine as well, as evidenced by the fact that the query’s failure (‘could not connect’) is returned. What am I missing?

$.ajax({
    url: 'functions.php',
data: {action: 'bagSubmit'},
type: 'post',
success: function(response){
    $('body').append(response);
}
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:13:59+00:00Added an answer on June 18, 2026 at 1:13 am
    <?php
        $host = "10.10.10.129";
        $user = "postgres";
        $pass = "";
        $dbase = "attest";
        $connect = pg_connect("dbname=$dbase host=".$host." user=".$user." password=".$pass) or die("I sense a disturbance in the force ");
    
        $action = $_POST['action'];
    
        switch($action){
            case 'bagSubmit' : 
                bagSubmit($connect); 
                break;
        }
    
        function bagSubmit($connect){
            $sql = 'SELECT * FROM cntrt';
            $query = pg_query($connect,$sql) or die('could not connect');
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried this so far: <?php $error = ; $conn = pg_connect(host=localhost dbname=brittains_db user=brittains
try to set host in dsn of pdo like this: <?php /* Connect to
I have a php file that holds my login details named connect.php. $host =
I have to perform a query similar to: <?php //....connect to database $old =
I got this PHP code: // connect to mysql require_once('includes/connect.php'); // include config include('includes/config.php');
when I connect to my database I include('connect.php') the document to connect. Now I
I need to use PHP to connect to a URL via a proxy server.
I'm using NuSOAP and PHP to connect to a web service (WSDL) and I
I am using the ODBC extension in PHP to connect to an SQL 2000
I'm having a really difficult time trying to get php to connect to SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.