A Service of Softnik Technologies

Adding Your Own Custom Auto Queries

You can add your own auto queries (the Auto Tab in the left category pane) using either the 'add' button in the footer or from the 'custom' tab.

Custom Auto Queries

You can use [domains] and [catconn] in the queries and the application will automatically add the table prefix. This will not happen for other tables, so if your query includes any other table, you will have to use the full table name.

Here are some sample Queries

List Domains That Don't Belong to Any Category

FROM [domains] a LEFT JOIN [catconn] b ON a.sid = b.sid WHERE b.sid IS null

List all COM Domains That Belong to a Specific Category

FROM [domains] a LEFT JOIN [catconn] b ON a.sid = b.sid WHERE b.CategoryID IN (SELECT CategoryID FROM dompunch_catlist WHERE CategoryName='Business Domains') AND a.domain LIKE '%.com'

Remember to replace dompunch_catlist in the SQL above with your actual table name (if your table prefix is not dompunch_).

Sample PHP Script

Here is a sample PHP script that adds an auto-query. You have to copy and paste the code below to a text file with .php extension, edit and save to the lib/php/ folder. Then execute the script from your browser.

<?php
require_once("config.check.php");
require_once("../../config.php");
require_once("base.php");

error_reporting(E_ALL);
connect_to_mysql_and_select_db();

$sql = "INSERT INTO `dompunch_queries` (`id`, `Name`, `Description`, `Query`) VALUES (NULL, 'Uncategorized Domains', NULL, 'FROM dompunch_domains a LEFT JOIN dompunch_catconn b ON a.sid = b.sid WHERE b.sid IS null')";

mysql_query( $sql ) or die("Couldn't execute your query.".mysql_error());
?>