How to Query a PostgreSQL Database
Posted: Sat Mar 12, 2011 6:19 pm
I can successfully connect, but I cannot seem to get a simple select query to work. Anyone have any sample connect and query code?
Thanks
Thanks
Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Voila.McJazz wrote:I can successfully connect, but I cannot seem to get a simple select query to work. Anyone have any sample connect and query code?
Thanks
Code: Select all
--- complete with ip adress, db name, user name and pwd
put revOpenDatabase("postgresql","xxx.Xxx.xxx.XXX","yourdbname","thedbuser","thepaswword") into dbID
if dbID is not a number then
answer "there is a problem "&dbID
else
answer "You are connected"
end if
put "SELECT * from yourtable" into dbSQL
put revDataFromQuery(, , dbID, dbSQL) into theData
answer theData
revCloseDatabase dbID