How to Enter and Retrieve Data to/from DB?
-
Hi,
I’m new to WP. I created a simple table named USER with WP Data Access plugin.
How do I create fields/form on the upper part of the page for user to enter name. email and store it to the DB, then retrieve and display the entered data on the lower part of the page?
Do I need to use Shortcode or php?
If so, how do I write/embed the program, and get it executed?
As an example, if I have a Database named mydb_wrdp1, which has a table named USER, how do I write Shortcode/PHP to address my Database and write data to the table USER?
Any advice and a link to some example that I can follow would be great;y appreciated.
Thank you.Vasut
-
Hi Vasut,
Welcome to the forum! ??
There are a number of ways to create data entry forms. The simplest is to just add your table to your WordPress dashboard menu. More information can be found here:
https://wpdataaccess.com/docs/documentation/data-explorer/add-crud-forms/If you are looking for more sophisticated data entry forms, you might want to check out this page:
https://wpdataaccess.com/docs/documentation/data-projects/overview/
Please be aware that this is just an overview of the Data Projects tool. The Data Projects tool allows you to create your own WordPress apps and contains a lot of features. I hope you’ll find the online tutorials helpful in learning how to work with it.There are a number of hook and filters which allow you to add your own code to the plugin pages (all types). More information can be found here:
https://wpdataaccess.com/code/Hope this helps to get started…
Best regards,
PeterPeter, Thank You!! for your quick and informative response.
This is awesome. I will study the tips and advice you provide and give it a try, and I will let you know how it goes.Cheers!
VasutHi Peter,
I followed the videos, and created a new Data Project and then added new Page.
But, while editing the new page, your video shows Table Name as text field. On my edit page it shows Table Name as a drop-down list of wp_* tables, none of which matches the names of the tables I created. The schema name is correct, but why don’t the table names get picked up?
Something I missed?Thanks,
VasutHi Vasut,
The video is a bit outdated, but generally is works the same way. The listboxes were added to allow plugin users to use remote databases (listbox schema name). Are your tables located in the WordPress database, or another (remote) database? If your tables are stored in another database, you first need to select your database.
Does this help?
Best regards,
PeterHi Peter,
I created my Database in WordPress, and it only has 3 tables without data yet.
The table names are USER, ROLE, USER_ROLE.
Data Projects recognizes my DB schema name invenflo_wrdp1.
However, the ‘Table Name’ drop-down list does not show any of my table names. It shows only WP system table names, like wp_options.
And since it’s a drop-down list and not a text field, I have no way of typing in my table name to try.Thank you,
VasutHi Vasut,
Can you check your back-end settings?
– Go to Settings menu
– Sub menu WP Data Access
– Tab Back-end
– Select your database
– Make sure table access is set to “show all tables”Does this help?
Best regards,
PeterHi Peter,
Table Access shows 3 options:
– Show WordPress tables
– Hide WordPress tables
– Show only selected tablesIt doesn’t have “show all tables”. Something must be missing in the configuration.
Vasut
When I designed New Table, I used the defaults – Engine: MyISAM, Collation: utf8_unicode_ci. Are these correct options?
Peter,
In addition to my previous two reponses, and I’m not sure if this is relevant, but I have both WP Data Access and Participants Database plugins installed, to try both out.
Not being able to create table with Participants Database, I decided to focus on WP Data Access, and was thinking about uninstalling Participants Database plugin. I’m not sure if having both plugins would confuse WP. It’s unlikely, as all my tables, so far, have been created witin WP Data Access. But, I don’t want to rule anything out of the suspect list.Thanks for staying with me and helping me on this. I really appreciate it.
Vasut
Hi Vasut,
Table Access shows 3 options:
– Show WordPress tables
– Hide WordPress tables
– Show only selected tables
It doesn’t have “show all tables”. Something must be missing in the configuration.There is nothing missing, it just means your tables are stored in the WordPress schema. That’s perfectly ok. Which options is enabled?
When I designed New Table, I used the defaults – Engine: MyISAM, Collation: utf8_unicode_ci. Are these correct options?
Yes
In addition to my previous two reponses, and I’m not sure if this is relevant, but I have both WP Data Access and Participants Database plugins installed, to try both out.
I don’t think these plugin interfere. Maybe you can just disable one plugin to test the other?
Can you add some screenshots? That often helps! You can use the contactform on the plugin website if you prefer to send them in private.
Best regards,
PeterHi Peter,
Your question: Which option is enabled?
> I tried all three options, but none showed any of my tables in the list.I’ve captured screenshots, but don’t see a way to attach a file here or on the Contactform page at the plugin site. Both seem to accept only text message.
Here, this message field seems to support HTML. But that probably does not work with local file referencing.But I’m still confused. If tables are stored in WP schema, shouldn’t WP recognize them and list them in the ‘Table Name’ drop-down?
Do you have a link to video clip showing the steps when you created the DB and tables from the start? I’d like to check if I did anything wrong, or any misstep.
Thank you,
VasutHi Vasut,
>>> I’ve captured screenshots, but don’t see a way to attach a file here or on the Contactform page at the plugin site.
You cannot add a screenshot directly. But you can add a link or just send me a message so I can reply. Ones you have my email address you can send attachments as well.
>>> But I’m still confused. If tables are stored in WP schema, shouldn’t WP recognize them and list them in the ‘Table Name’ drop-down?
Yes, it should! Did you create the table? With the Data Designer you first have to design a table and then create the table from your design. Here is a link to video where this process is explained:
https://wpdataaccess.com/docs/documentation/data-designer/basic-mode/Best regards,
PeterHi Peter,
Problem is solved. You are Correct!
I did the Table Design, but Not the Table Create.
Also, I went along with the (default) ‘Advanced Design Mode’, Not the ‘Basic Design Mode’.
After correcting the mistake, I can now see my table ‘USER’ in the list. ??
I’m going to flag this topic as Resolved.
I’m pretty sure I’ll run into more challenges, in which case I’ll search through existing topics and if I can’t find similar issue I’ll open a new topic.Thank you, Peter.
Next time, if any beginner comes to you with this problem, you can go straight to your most recent question: ‘Did you Create the table?’ Haha.
By the way, I really like your training videos. Good pace. Good explanations, easy to understand and follow, and you have an outstandingly nice voice and accent.Best Regards,
VasutThanks to your guidance and video, I can publish data from a table on the page now.
If you don’t mind I’d like to ask one more question here:
How do you enter an image to the table’s blob/binary field and show it as image on the page?
I saw your example showing nice motorcycle images.
I have a User table that I’d like to show a thumbnail image of the users.Thanks,
VasutHi Vasut,
Great you solved it! ?? And thanks for your compliments.
You can add any media type from the WordPress media library to your tables. A video tutorial can be found here:
https://wpdataaccess.com/docs/documentation/data-explorer/wordpress-media-library-integration/Ones you changed the column type, the plugin will add media capabilities in your Data Explorer, projects and publications. Media can be added, updated and deleted in data entry forms and will be shown automatically in list tables and publications.
Best regards,
Peter
- The topic ‘How to Enter and Retrieve Data to/from DB?’ is closed to new replies.