Querying a database for content

This forum is for all Flare issues not related to any of the other categories.
Post Reply
pviscogl
Propeller Head
Posts: 16
Joined: Wed Sep 14, 2011 6:11 am

Querying a database for content

Post by pviscogl »

Hi,
I have a project where I would need to use information from a database for use in Flare. Is there a module, or other tools i can use with Flare to query an external database and to put the query result as content to be used in Flare.

For example, the machanical division of company X produces different versions of a product. The product has some technical specifications, dimensions, etc... The mechanical department is responsible to fill in the database with all specifications, etc...
The product comes in different flavors. Flavor A with Spec A, Flavor B with Spec B, etc...

I want to produce one manual for the different flavor of the product. I would like to be able to use something to query the database for the specifications, put the query results in some variables' values, and produce the different manuals with Flare.

I hope this is clear. If someone knows how I can do this, please let me know.

By the way, I am aware of the different 'server' integration such as Sharepoint. I do not want to use a pdf from Sharepoint or something like this. I want to 'build' my own content using database queries. This would save a lot of manipulations.

Thanks,
Pascal
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Querying a database for content

Post by RamonS »

You can do that with PHP. Embed PHP code in the page to connect to the database and query the tables, then prepare the results for output.
pviscogl
Propeller Head
Posts: 16
Joined: Wed Sep 14, 2011 6:11 am

Re: Querying a database for content

Post by pviscogl »

Thanks Ramon... that was fast!
when you say:
RamonS wrote:You can do that with PHP. Embed PHP code in the page to connect to the database and query the tables, then prepare the results for output.
could you share some PHP code examples?

how do you put the query results in a variable value?

Thanks again.
Pascal
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Querying a database for content

Post by RamonS »

An example would be this:
http://www.w3schools.com/php/php_mysql_select.asp
That queries a table and spits out the results. That said, this will work only for online output and in that case you really do not need to inject that into a variable because the query results are generated dynamically each time the page is called up. While custom code like this is not unusual it is not a trivial copy & paste.

If you want to create printed/printable output my suggestion will not work and I cannot think of any easy means that would grab the query results and inject it into a variable that then gets used during output.
How frequently do tech specs change? If this happens only once in a while then a low tech copy & paste might be the easiest means to get the content in place.
pviscogl
Propeller Head
Posts: 16
Joined: Wed Sep 14, 2011 6:11 am

Re: Querying a database for content

Post by pviscogl »

RamonS wrote:An example would be this:
http://www.w3schools.com/php/php_mysql_select.asp
That queries a table and spits out the results. That said, this will work only for online output and in that case you really do not need to inject that into a variable because the query results are generated dynamically each time the page is called up. While custom code like this is not unusual it is not a trivial copy & paste.

If you want to create printed/printable output my suggestion will not work and I cannot think of any easy means that would grab the query results and inject it into a variable that then gets used during output.
How frequently do tech specs change? If this happens only once in a while then a low tech copy & paste might be the easiest means to get the content in place.
Thanks again Ramon.
We are trying to automate this task as most as possible. This would, amoung other things, reduce the risk of cut and paste errors. I don't see this 'problem' as a frequency problem, i.e, it is not because we change frequently the specs. It is the number of specs involves and the possibility to fill in the table automatically with the specs, right from the source, thus reduncing risk of errors in the process... hope my precision helps understand my goal.
Except 'esay way' of doing this, do you know if there are other tools, or if a programmer could write codes to perform this 'query database - fill in ' process??
Thanks
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Querying a database for content

Post by RamonS »

pviscogl wrote: Except 'esay way' of doing this, do you know if there are other tools, or if a programmer could write codes to perform this 'query database - fill in ' process??
Thanks
No, I do not of any ready to go tools for this that will automate that task and work seamlessly with Flare. If you generate browser based output then the code solution is most likely the most robust and easiest means. Yes, you would need the help of a fairly well-rounded web developer for this. It does not have to be PHP, there are other options. PHP is often the first option for writing 'glue code' like this.
kathryngz
Propeller Head
Posts: 76
Joined: Wed May 14, 2014 11:31 am

Re: Querying a database for content

Post by kathryngz »

I know this is an old thread, but it's relevant to what I'm trying to do now.
RamonS wrote:You can do that with PHP. Embed PHP code in the page to connect to the database and query the tables, then prepare the results for output.
I've done this type of thing frequently on regular (non-Flare) websites. But in order to run PHP code on a page, I thought it had to have a php extension.

If you changed the topic extension to .php, how did you do it? And if not, how did you "embed" the php code?

Thanks!

Kathryn
jjw
Sr. Propeller Head
Posts: 133
Joined: Thu May 08, 2014 4:18 pm
Location: Melbourne

Re: Querying a database for content

Post by jjw »

On the Advanced tab of the target there's an option "Use custom file extension for topics".
Post Reply