KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Load Select component from query #3127

Open Alan Sawyer opened this topic on on Aug 27, 2023 - 1 comments

Alan Sawyer commented on Aug 27, 2023

I tend to want to use sql queries to do things as I'm a database developer.

I am just learning KoolReports and by no means an expert at PHP, but I learn best from examples.

I want to use "inputs" and want to load values of companies in a select field (combobox).

I am not getting the syntax right.

Can someone help?

Thanks Alan

Alan Sawyer commented on Aug 27, 2023

This is what I'm trying now.

<?php

$sql = "select Name from Companies where name like 'ding%'";

  Select::create(array(
    "name"=>"select",
 $this->src('cloud1')
        ->query($sql)
        ->pipe($this->dataStore('companies'));
    "defaultOption"=>array("All Companies"=>""),
    "dataBind"=>"Name",
    "attributes"=>array(
        "class"=>"form-control",
    )
));

?>

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

Inputs