Commit df2e7ea9 authored by dmorley's avatar dmorley

cleanup my SELECT statements

parent 6705599c
......@@ -4,7 +4,7 @@ require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT * FROM pods WHERE score < 50 ORDER BY weightedscore";
$sql = "SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,score,signup,secure,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp,responsetime,dateupdated,ipv6,total_users,local_posts,comment_counts,statsurl,userrating,sslvalid FROM pods WHERE score < 50 ORDER BY weightedscore";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -73,7 +73,7 @@ while ($row = pg_fetch_all($result)) {
$adminratingavg = [];
$userrating = [];
$adminrating = [];
$sqlforr = 'SELECT * FROM rating_comments WHERE domain = $1';
$sqlforr = 'SELECT admin,rating FROM rating_comments WHERE domain = $1';
$ratings = pg_query_params($dbh, $sqlforr, [$domain]);
$ratings || die('Error in SQL query2: ' . pg_last_error());
......
......@@ -56,7 +56,7 @@
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT * FROM rating_comments WHERE domain = $1';
$sql = 'SELECT admin,username,userurl,rating,comment,date,id FROM rating_comments WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT * FROM pods WHERE NOT hidden AND signup ORDER BY uptime_alltime DESC";
$sql = "SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,score,signup,secure,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden AND signup ORDER BY uptime_alltime DESC";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT * FROM pods ORDER BY uptime_alltime DESC';
$sql = 'SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,score,signup,secure,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp,responsetime,dateupdated,ipv6,total_users,local_posts,comment_counts,statsurl,userrating FROM pods pods ORDER BY uptime_alltime DESC';
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -29,7 +29,7 @@ foreach ($csv as $cords) {
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT * FROM pods WHERE NOT hidden";
$sql = "SELECT domain,signup,secure,name,lat,long,uptime_alltime,active_users_halfyear,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment