Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    137

    Unanswered: plz help with this SQL

    I am trying this in php but it's not working.. when i try it in SQL Server it works fine without any problem!!

    $illing_sql = "SELECT billing.billing_id, billing.detail, billing.start_date_time, billing.amount FROM customers INNER JOIN (accounts INNER JOIN billing ON accounts.account_id = billing.account_id) ON customers.customer_id = accounts.customer_id WHERE customers.customer_id = 84";

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    The sql statement/string looks ok. The most common reason why queries fail from PHP is an problem with the connection to the server or the syntax of the query statement. How do you know this is not working? Is there an error message? If so, post the error message to get the best help.

    One thing that always helps when debugging a problem is to set the error_reporting to tell you everything possible. Place the following near the start of your PHP code -
    PHP Code:
    error_reporting(E_ALL); 
    Could you post your PHP code starting with the statement that connects to the server through to the actual query (xxxxx out any sensitive information such as a password.)

  3. #3
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    I am assuming this part of the same code posted in the other thread. There is a typo error between the string variable name and the string variable name being used in the query function call -
    PHP Code:
    $illing_sql "SELECT billing.billing_id, billing.detail, billing.start_date_time, billing.amount FROM customers INNER JOIN (accounts INNER JOIN billing ON accounts.account_id = billing.account_id) ON customers.customer_id = accounts.customer_id WHERE customers.customer_id = 84";
    $billing_result pg_exec($pg_connection$billing_sql); // this is not $illing_sql 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •