Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Accessing Database from The UI

  • skandoi
  • skandoi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #182903 by skandoi
Accessing Database from The UI was created by skandoi
I want to access the limesurvey database from the Template , is it possible ? . My problem is if any one fill the form (survey ) i want to compare the token of participant from the database before submitting the form so , please suggest me any idea how I achieve this .

Thanks,
subham
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #182908 by tpartner
Replied by tpartner on topic Accessing Database from The UI
There is no direct way to access the database from within the LimeSurvey GUI.

You would probably need to code a remote PHP script to do that, maybe via the API.

- www.limesurvey.org/manual/RemoteControl_2_API

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • skandoi
  • skandoi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #182911 by skandoi
Replied by skandoi on topic Accessing Database from The UI
Actually i want to use API dynamically , can you suggest how I use API dynamically (when the participants fill the form at that time that API will called to check the condition according to my requirements I write the condition ) and where ?
Thanks for reply
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #182921 by tpartner
Replied by tpartner on topic Accessing Database from The UI
An AJAX call to the remote PHP script would work but it's too much coding for me to give a working example.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • skandoi
  • skandoi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #182923 by skandoi
Replied by skandoi on topic Accessing Database from The UI
can you only suggest the location where i write the code . I will try by myself .
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #182925 by tpartner
Replied by tpartner on topic Accessing Database from The UI
The AJAX call would be a script in the survey (question source or custom.js file), presumably fired when the form is submitted.

The API call (or SQL query) would be in a remote PHP script accessed via the AJAX call.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • skandoi
  • skandoi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #183599 by skandoi
Replied by skandoi on topic Accessing Database from The UI
Hi ,

I tried but not able to do that, can you please give any example if possible .

Thanks ,
subham
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #183619 by Joffm
Replied by Joffm on topic Accessing Database from The UI
If you do a search here for "ajax call" you find at least two examples:
www.limesurvey.org/forum/can-i-do-this-w...ecific-quotas#181176
and
www.limesurvey.org/forum/can-i-do-this-w...rmation-email#181066

The php script is your part.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #183623 by tpartner
Replied by tpartner on topic Accessing Database from The UI
Searching the forums for "jsonRPCClient" will yield many examples of using the API with PHP.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose