You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND field_keyword = 'bgcol'' at line 5
SELECT val_value FROM cms_page_fields, cms_page_field_values WHERE val_fieldID = field_id AND val_pageID = AND field_keyword = 'bgcol'
array(4) {
  [0]=>
  array(4) {
    ["file"]=>
    string(79) "/srv/data/vhosts/simonarmstrongcreative.com/httpdocs/admin/pages/class.page.php"
    ["line"]=>
    int(309)
    ["function"]=>
    string(7) "dbQuery"
    ["args"]=>
    array(1) {
      [0]=>
      string(160) "SELECT val_value
				  FROM cms_page_fields, cms_page_field_values
				  	WHERE val_fieldID = field_id
				  AND val_pageID = 
				  AND field_keyword = 'bgcol'"
    }
  }
  [1]=>
  array(7) {
    ["file"]=>
    string(83) "/srv/data/vhosts/simonarmstrongcreative.com/httpdocs/site/includes/content-page.php"
    ["line"]=>
    int(20)
    ["function"]=>
    string(20) "get_custom_field_val"
    ["class"]=>
    string(4) "page"
    ["object"]=>
    object(page)#64 (32) {
      ["id"]=>
      string(0) ""
      ["parent"]=>
      string(1) "0"
      ["menu"]=>
      string(7) "mainNav"
      ["dateModified"]=>
      string(10) "2023-06-14"
      ["title"]=>
      string(4) "Work"
      ["menuTitle"]=>
      string(4) "Work"
      ["slug"]=>
      string(4) "work"
      ["seo_req"]=>
      string(1) "1"
      ["pos"]=>
      string(1) "4"
      ["parentAsPage"]=>
      string(1) "1"
      ["active"]=>
      string(1) "0"
      ["showTitle"]=>
      string(1) "0"
      ["status"]=>
      string(5) "draft"
      ["accesskey"]=>
      string(0) ""
      ["maximages"]=>
      string(1) "0"
      ["uselinks"]=>
      string(1) "0"
      ["header"]=>
      string(1) "1"
      ["type"]=>
      string(1) "1"
      ["type_val"]=>
      string(0) ""
      ["language"]=>
      string(1) "1"
      ["user_access"]=>
      string(0) ""
      ["menuimg"]=>
      string(1) "0"
      ["menu_class"]=>
      string(0) ""
      ["ishome"]=>
      string(1) "0"
      ["path"]=>
      NULL
      ["text"]=>
      NULL
      ["fields"]=>
      array(11) {
        [0]=>
        array(12) {
          ["field_id"]=>
          string(2) "19"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(11) "subpage_nav"
          ["field_type"]=>
          string(8) "CHECKBOX"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(28) "Show navigation on sub-pages"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(1) "0"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [1]=>
        array(12) {
          ["field_id"]=>
          string(2) "20"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(18) "show_sharing_links"
          ["field_type"]=>
          string(8) "CHECKBOX"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(18) "Show sharing links"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(1) "1"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [2]=>
        array(12) {
          ["field_id"]=>
          string(2) "23"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(10) "dark-theme"
          ["field_type"]=>
          string(8) "CHECKBOX"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(10) "Dark theme"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(1) "1"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [3]=>
        array(12) {
          ["field_id"]=>
          string(1) "5"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(5) "bgcol"
          ["field_type"]=>
          string(6) "COLOUR"
          ["field_params"]=>
          string(0) ""
          ["field_label"]=>
          string(17) "Background colour"
          ["field_tips"]=>
          string(0) ""
          ["field_pos"]=>
          string(1) "2"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [4]=>
        array(12) {
          ["field_id"]=>
          string(2) "18"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(11) "hide_footer"
          ["field_type"]=>
          string(8) "CHECKBOX"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(11) "Hide footer"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(1) "3"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [5]=>
        array(12) {
          ["field_id"]=>
          string(2) "10"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(18) "page_related_title"
          ["field_type"]=>
          string(4) "TEXT"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(21) "Related content title"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(2) "10"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [6]=>
        array(12) {
          ["field_id"]=>
          string(2) "11"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(13) "page_related1"
          ["field_type"]=>
          string(5) "IMAGE"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(9) "Related 1"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(2) "11"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [7]=>
        array(12) {
          ["field_id"]=>
          string(2) "12"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(13) "page_related2"
          ["field_type"]=>
          string(5) "IMAGE"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(9) "Related 2"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(2) "12"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [8]=>
        array(12) {
          ["field_id"]=>
          string(2) "13"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(13) "page_related3"
          ["field_type"]=>
          string(5) "IMAGE"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(9) "Related 3"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(2) "13"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [9]=>
        array(12) {
          ["field_id"]=>
          string(2) "21"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(13) "page_related4"
          ["field_type"]=>
          string(5) "IMAGE"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(9) "Related 4"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(2) "14"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
        [10]=>
        array(12) {
          ["field_id"]=>
          string(2) "22"
          ["field_pageID"]=>
          string(1) "0"
          ["field_keyword"]=>
          string(13) "page_related5"
          ["field_type"]=>
          string(5) "IMAGE"
          ["field_params"]=>
          NULL
          ["field_label"]=>
          string(9) "Related 5"
          ["field_tips"]=>
          NULL
          ["field_pos"]=>
          string(2) "15"
          ["val_id"]=>
          NULL
          ["val_pageID"]=>
          NULL
          ["val_fieldID"]=>
          NULL
          ["val_value"]=>
          NULL
        }
      }
      ["links"]=>
      array(0) {
      }
      ["images"]=>
      array(0) {
      }
      ["leaf"]=>
      bool(false)
      ["trans_id"]=>
      NULL
      ["lang"]=>
      string(2) "en"
    }
    ["type"]=>
    string(2) "->"
    ["args"]=>
    array(1) {
      [0]=>
      string(5) "bgcol"
    }
  }
  [2]=>
  array(4) {
    ["file"]=>
    string(67) "/srv/data/vhosts/simonarmstrongcreative.com/httpdocs/site/index.php"
    ["line"]=>
    int(189)
    ["args"]=>
    array(1) {
      [0]=>
      string(83) "/srv/data/vhosts/simonarmstrongcreative.com/httpdocs/site/includes/content-page.php"
    }
    ["function"]=>
    string(7) "include"
  }
  [3]=>
  array(4) {
    ["file"]=>
    string(62) "/srv/data/vhosts/simonarmstrongcreative.com/httpdocs/index.php"
    ["line"]=>
    int(2)
    ["args"]=>
    array(1) {
      [0]=>
      string(67) "/srv/data/vhosts/simonarmstrongcreative.com/httpdocs/site/index.php"
    }
    ["function"]=>
    string(7) "include"
  }
}