Saving form data and running custom queries in mysql

I’m new to drupal and although I’ve researched and asked some questions I’m still stuck on how I can achieve my end result. I have built a php/html/mysql website (www.gbpokerclub.co.uk) but I now want to create it in drupal, mainly so I can easily give different users their own permission levels, and also so I can have my admins do some of the content editing.

Most of that I’ve worked out but the bit I’m stuck on both practically and conceptually is how I can record data into custom tables and retrieve that into leaderboards and results tables.

At present an admin logs poker game results via a form, this records the venue id, player id, finishing position etc into a mysql table. I have other tables that record venue details, player details, agent details etc. I then have some complex mysql queries that take data from results, player and venue tables, performs some calculations on it and spits out a leaderboard showing who has the most points.

This is currently done using forms to input the data, and mysql queries and php include files to drop the data back into a presentable format on the webpage.

My big question is ..

How can I emulate this process in Drupal?

the feedback I’ve had so far suggests I could use content nodes with specialised types, or custom DB tables and views to present it back, or coding a custom module, but I’ve also been warned against using SQL and to use the database.api instead.

To be honest there seems to be many solutions to the achieve what I need, but I’m ideally looking for someone to tell me exactly which method I should go with and how I should go about implementing the solution.

I hope that all makes sense! Thanks

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Saving form data and running custom queries in mysql

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.