Query returning no results

Hello! I am having a rather difficult time getting query results returned when using a WHERE condition and the database field is an INT. I’m trying to use a session variable which I have changed to both text and number. I’ve tested displaying the session variable in a text field and is displays OK. This is usually a really basic operation and I have been playing with this for hours. I know the query is OK as it is very basic, and returns rows when I remove the WHERE condition… and yes I have even checked to make sure there is a valid result to be returned :slight_smile: … would appreciate any ideas, thanks! Here’s my sql query: SELECT * FROM chapters WHERE bookID =:P1/* {{$_SESSION.currentbookid}} */

Hello, have you tried checking for errors, when running the server action:

Also - how do you set the session value, and where? What are you server action steps?

Thanks for the response!

Session variable is set via clicking on a button to set the value of the session variable in the session storage manager. I can successfully display the value of the session variable in a text field. I think there’s some kind of data type issue or conflict with treating the value of the variable as a string rather than an int.

Server action steps are 1. Database connection 2. security provider 3. database query… the query returns and displays data if I remove the WHERE clause. I’ve also ensured the session variable is listed in the GLOBALS section of the server action.

I’m having a look at the debug info now for something useful…

This is interesting…

{listChapters: {,…}}
listChapters: {,…}
options: {connection: “scrud”, sql: {type: “select”, columns: , table: {name: “chapters”}, joins: ,…},…}
params: [{id: “chapters.bookID”, field: “chapters.bookID”, type: “string”, operator: “equal”, value: null,…}]
query: “SELECT * FROM chapters WHERE (bookID = ?)”

These are totally different things.
The session manager handles browser sessions, the $_SESSION in server connect represents server sessions. So, what you set in a browser session via the state manager component on the page will never be available in the server sessions …

If you need to set a session on the server side, use the SET SESSION step available in server connect.

Do not enable the debug option for the query … just enable debug as shown in the tutorial i sent you. But anyway, you won’t need this, as the problem you are having is with the confusion with the browser sessions and server sessions.