sql statement to show client/domain list

Discussion in 'General' started by larwilliams, Apr 2, 2007.

  1. larwilliams

    larwilliams New Member

    Hi, I am trying to write a small PHP script that lists domains by client (just for a simple page)..


    Client 1

    Client 2

    Client 3

    I've got a partially working SQL query which pulls up a list of domains.. i am just really confused about the table dependencies and stuff.

    This is what gets me a list of domains right now:
    select web_host, web_domain from isp_isp_web, isp_dep, isp_isp_user where isp_isp_web.doctype_id = isp_dep.parent_doctype_id and isp_isp_web.doc_id = isp_dep.parent_doc_id and isp_isp_user.doctype_id = isp_dep.child_doctype_id and isp_isp_user.doc_id = isp_dep.child_doc_id
    If someone experienced with the sql linking could post the proper SQL statement, it would be much appreciated.

    - Lawrence
    Last edited: Apr 2, 2007
  2. falko

    falko Super Moderator ISPConfig Developer

    This should work:

    SELECT isp_dep.child_doc_id FROM isp_dep, isp_nodes WHERE isp_nodes.doc_id = isp_dep.child_doc_id and isp_nodes.doctype_id = '1013' AND isp_nodes.status = 1 AND isp_dep.parent_doc_id = '$doc_id' AND isp_dep.parent_doctype_id = '1012' AND isp_dep.child_doctype_id = '1013'
    where $doc_id is the doc_id of the customer.

    The child_doc_id that you get then is the doc_id of the corresponding web site from isp_isp_web.
  3. larwilliams

    larwilliams New Member


    Just to confirm, the customer information (business name, first name, last name, and more) is stored in the isp_isp_kunde database, am I right?

    I guess my script will need 3 queries... not a problem though.


    - Lawrence
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, it is in the isp_isp_kunde table.

Share This Page