Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hello
I have a mysql db with products. That products is automatically updated through api call and a php script to convert json data and save them to db.
Is there a way to show the data i already have in db in couch pages?
Thank you
anyone please
Hi :)

I am sorry but it was not clear (to me) from your question as to exactly how you'd like to utilize the data you have in the database.

Is it that -
1. You only need to display the data on a Couch managed template? or
2. You need to use the data to actually create cloned-pages in Couch (which then, of course, can be displayed as per usual).

If the answer is '1', you have the following options -
a. You can use <cms:php> tags in your Couch template to execute raw PHP. You can formulate SQL queries in PHP the regular way, fetch the data and display it through PHP.

b. this extends point 'a' above - After fetching the data using PHP, you can set it in Couch's context as PHP array. Then anywhere in the template you can simply use Couch's <cms:each> tag to loop through that array and show the data. For this please see viewtopic.php?f=5&t=10892

c. If the data that you have resides in the same database as your Couch installation, then instead of PHP you can use Couch's <cms:query> tag to fetch and show the data. Please see viewtopic.php?f=5&t=7377 (find the "2. Executing custom SQL queries." section in that post).

If the answer is '2', then you can import that data into Couch to create cloned pages. You may modify the 'CSV importer' we have to do so - viewtopic.php?f=5&t=8803

Finally, if the answer is none of the two, please let me know in more detail about your use-case.

Hope the reply helps.
Hello KK

I believe the option 2 is better but i dont know how to change the csv importer to import data from mysql table and add them to mysql table. can anyone help me do this?
4 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests