MySQL Views in Wappler

Okay I have such a dumb question but I have spent what seem’s like an eternity trying to figure this out.

I am loving Wappler and still learning the software, as a longtime Dreamweaver user this is an amazing tool.

so…
I read so much about people saying “Create a view in MySQL and use it in Wappler” great, but I cannot get it to display.
I have numerous tables with joins, insert and deletes using Wappler, all working like a charm, however I have a “Count, Group By, Having” View in MySQL that displays and works (in MySQL) however when I add the View to Wappler it returns nothing.

I create an action file, add a connection and query (don’t use any joins just the view), create the Server Connect and add a table, the headers are picked up and displayed however nothing, no data, just blank.

I have looked and looked but I am unable to figure it out, apparently i’m not that bright, I am setting the View up the same way I set up from a Table and all my tables work exactly as needed.

What am I missing? (is there a tutorial available?)
I’m connected to MySQL via a remote connection, however as stated the Table queries work fine.

Thanks,
Shaun

Have you tried activating debug mode in the server connect settings and looking for errors in your browser’s developer console?

@Hyperbytes Thank you for the suggestion, I’m getting a “SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared” on my Views only.

I have limited administration to MySQL due to my shared hosting, however, I created a new view using recommendations … (below)

SELECT x.mins_contact,x.mins_min3, Count(*) as cnt
From (select mins_contact,mins_min3 from acts_mins) x
group by x.mins_contact
having cnt = 1 and x.mins_min3 = 6;

This returns all entities that only have a single entry AND a certain designation. (DB is normalized)

These requests work both in MySQL Workbench and PHPMyAdmin as a SQL Statement or accessing the view, however Wappler throws back the stated error. I may have to build a standalone page outside of Wappler to return the information (really don’t want to do that).

Maybe I can do a group by and count on the table and apply the filter post render… needs more thought. (sorry personal ramblings )

Crazy this happens on only views.

Shaun

Check your mysql connection settings as below.

prepare Statements should be Auto or True (if auto does not work)

6 Likes

@Hyperbytes That fixed it! fantastic!

Had to set to True

Thank you,
Shaun

2 Likes

@Hyperbytes,

Just wanted to post a quick response to say that this worked for me too! :slight_smile:

1 Like

An old post, but wanted to say thank you for this, was tearing remainder of my hair this morning with views, and just turning it to True, resolved my issues !!!

3 Likes

Found this post today:)
I have a Node project hosted on Digital Ocean, and a MySql8 database, also on Digital Ocean.
Connected to Db OK, but cannot se the created Views on the sql server (Visible in Navicat).

I now only got only Direct Connection available, an there is no option for “Prepare Statement” as listed as a solution.
Do you know how to make the views visible in this kind of project, needed as I have to join two tables of users and use the view in the Security Provider.
I can use “Select * from ViewName” in custom query, but Views not visible in database explorer

Regards
Olav nielsen

I don’t think this has been resolved yet.

This has been improved in Wappler 3.7.5
Now you can see the database view in the Database Manager

This topic was automatically closed after 45 hours. New replies are no longer allowed.