How To Install DBQ Component in Joomla!
Download DBQ
- Download Database Query for Joomla! 1.0 here.
Install DBQ
- Login into the administration area and go to Installers > Component from the menu.
- Use the “Choose…” button under Upload Package File to select the file you just had downloaded. Then click on Upload File & Install.
- If installation is successful, a “Upload component – success” page will appear.
Connect DBQ to your database
- In the administration area, go to Component > DBQ Manager > Databases.
- Click New to specify new database connection.
- Select the correct Driver and Type according to your database. Enter “localhost” as the Hostname if you are using a local web server. Schemaname is the name of your database in the web server. Fill in the right Username and Password. Click Save when you are done.

Create Category
- In the administration area, go to Component > DBQ Manager > Categories.
- Click New to create a new category and fill in the Category Name, Category Title, and Description. Click Save when you are done.
Basic Search Query
Step One: Create the Query.
- In the administration area, go to Component > DBQ Manager > Queries.
- Click New to create a new query.
- Type in your SQL statement. For this exercise, I use the following SQL:
SELECT
pel_name AS $<Pelajar_Name>,
pel_no_matriks AS $<Pelajar_No_Matriks>,
pel_sesi AS $<Pelajar_Sesi>,
pel_id AS $<Pelajar_View_Link>
FROM tbl_pelajar
WHERE pel_id != 0 - Fill in all the other fields in the Configuration tab as illustrated below:

- On the Attributes tab, set Published to “Yes”.
- On the Parameters tab, set Order Variables As Found In Query to “Yes”.
- Click Save. The query will be listed in DBQ Manager > Queries. You can also view the query on the front end at http://localhost/joomla/index.php?option=com_dbquery
Step Two: Parse the Query.
- Tick the checkbox next to the query name, and click the Parse button.
- Check that the type of each variable is set to “Field Variable”
Step Three: Configure the Variables.
- Set all variables to active
Display Your Query
- Now that your query is ready, you can assign it to a menu in Joomla!. In the administration area, go to Menu > mainmenu.
- Click New. Select Components.
- Specify the name of your menu. Select DBQ Manager from Component and click Apply.
- Under parameters, enter the DBQ Query ID for your created query (you can check it on DBQ Manager > Queries) and click Save.
- You will see your newly created menu on your Joomla! home page.
Advanced Search Query
- In the administration area, go to Component > DBQ Manager > Queries.
- Tick our previous query and click the Copy button.
- Click on the query name to modify it using the following SQL:
- Parse the query. Set :
- PEL_SEARCH_NAME, PEL_SEARCH_SESI and PEL_SEARCH_NO_MATRIKS to type “Statement Variable”.
- pel_search_name to type “Keyword Variable”
- pel_no_matriks and pel_search_sesi to type “Query Result Variable”
- Configure the variables:
- Edit each statement variable to “Not Required”
- For “Keyword Variable”, use “Text Box”
- For “Query Result Variable”, use the “Drop Down List” input
Set SQL query for pel_no_matriks in the Parameters tab: SELECT pel_no_matriks AS value, pel_no_matriks AS label FROM tbl_pelajar ORDER BY pel_no_matriks- Set SQL query for pel_sesi in the Parameters tab: SELECT pel_sesi AS value, pel_sesi AS label FROM tbl_pelajar ORDER BY pel_sesi
- Set the Data Source to “SQL Query”
- Test the query.
SELECT
pel_name AS $<Pelajar_Name>,
pel_no_matriks AS $<Pelajar_No_Matriks>,
pel_sesi AS $<Pelajar_Sesi>,
pel_id AS $<Pelajar_View_Link>
FROM tbl_pelajar
WHERE pel_id != 0
$[PEL_SEARCH_NAME: AND pel_name LIKE '%${pel_search_name}%' ]
$[PEL_SEARCH_NO_MATRIKS: AND pel_no_matriks = '{pel_search_no_matriks}' ]
$[PEL_SEARCH_SESI: AND pel_sesi = '${pel_search_sesi}' ]
Basic View Query
This query will let the user view a specifc record in the table. Our third query resembles the other two queries except that it displays additional felds and accepts only a single input, the record ID.
- Create the query:
- In Attributes tab, set Rotate Results to “Yes”
- Parse the query:
- pel_id as “Keyword Variable”
- others as “Field Variables”
- Configure variables: pel_id to “Required”
- Test query.
SELECT
p.pel_no_matriks AS $<Pelajar_No_Matriks>,
p.pel_name AS $<Pelajar_Name>,
j.jab_name AS $<Jabatan_Name>,
p.pel_sesi AS $<Pelajar_Sesi>,
p.pel_alamat AS $<Pelajar_Alamat>,
p.pel_jantina AS $<Pelajar_Jantina>,
p.pel_ic AS $<Pelajar_Ic>,
p.pel_no_tel AS $<Pelajar_No_Tel>,
p.pel_id AS $<Pelajar_View_Link>FROM tbl_pelajar p, tbl_jabatan jWHERE p.pel_id = ${pelajar_id} AND p.jab_id = j.jab_id
Linking Queries Together
Earlier, we created the Pelajar_View_Link field variable which presented the record id for the selected record. We will now modify this variable to create a link to the View query
- Configure the variable, Pelajar_View_Link:
- In Parameters tab, set Enable Next Query to “Yes”
- Set Next Query ID, enter the query ID
- Set Next Query Task to “Execute Query”
- Set Target Variable to pelajar_id
- In Special tab, Enter: $replacement = ‘view’;
- Hide the view query using the query parameter “Hide On Select Screen”
- Test the query.
ketek said
useless without pix
Nitin said
I want to run a query based on user name…. actually i have one table for each user in database and i want to display the contents of the table of the logged in user. How do i do that?? any ideas!!!