register_graphql_fields
and register_graphql_object_type
functions provided by the WPGraphQL plugin (says ChatGPT).cheers, Karl
]]>fiction_book
and nonfiction_book
.
I have put this in my themes>function.php file (after having defined the user, password, db name, and host in my wp-config.php file):
function booksdb() {
global $booksdb;
$booksdb = new wpdb(BOOKS_DB_USER, BOOKS_DB_PASSWORD, BOOKS_DB_NAME, BOOKS_DB_HOST);
}
add_action('init', 'booksdb');
And I understand I can retrieve data from the database with something like:
<?php
$fictionbooks = $booksdb->get_results("SELECT * FROM $booksdb->fiction_book");
if ( $fictionbooks ) {
foreach ( $fictionbooks as $fictionbook ) {
do_something($fictionbook);
}
} else {
do_something_else($fictionbook);
}
?>
Having gotten that far, my initial question is: How do I confirm that I am connected to my database and am retrieving data?
Then, secondly: What is needed in do_something
to populate the page? Or at least what is the first step I need to tackle in do_something
?
Code examples I’ve seen show code of how to do things, but often don’t say what file the code should go in. And I’m not sure what code goes in WordPress files/folders and what code goes in my theme’s files/folders.
I’m not looking for a complete solution at the moment, but certainly all input is welcome. I just need a jump start. Maybe pseudo-code or the steps I’ll need to figure out the code for.
Thanks!
]]>Thanks
]]>I cannot seem to see any errors despite attempting to log them. Do you have instructions on how to view the plugin’s errors? Also, is there anything else I’d need to install to get this working with postgresql?
]]>This plugin, in conjunction with WP Forms Lite works with the minimal amount of fuss and bother. What more could you ask?
]]>I was able to install & use WordPress-4.8.1 with PostgreSQL-9.4.13 with zero problems. No install errors whatsoever.
]]>https://www.ads-software.com/plugins/wordpress-database-abstraction/
]]>Is it possible to retrieve information from an external Postgres database , update them and send them back?
E.g
A user can log into a page and see some information, change them as needed and save them back to te database. The database is hosted on an external server.
I’m quite new to websites design so I have no idea where to begin. I would be very grateful to anybody who can point me in the right direction.
Cheers
Irene
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>