Questions tagged [mysql]

MySQL is an open-source, relational database management system. If your PHP code uses MySQLi, use the MySQLi tag instead.

Filter by
Sorted by
Tagged with
0
votes
1answer
93 views

PHP/MySQL login

I just wanted to ask if this is a secure code (doesn't really matter if it's optimal or not) The code ...
-3
votes
1answer
49 views

3 tables in SQL [closed]

Lets say i have 3 tables: users, posts and comments. ...
1
vote
1answer
71 views

Using MySQL with Wai and Warp

I was wondering if below is the correct convention for combining Wai with a Database pool. What I basically do is, create a pool, partially apply a function of type ...
2
votes
0answers
34 views

Many to many (n to m) relationship without insert duplication php

I managed to make a many to many relationship work correctly using mysql, doctrine 2 and symfony 3.4. When a new element A that contains 0 to m element Bs is inserted, the B elements that already ...
3
votes
1answer
37 views

Stored procedure for sending emails at specified times after license expiration

I need to send email notifications for expired licenses: One Day Before/After Expiration Two Days Before/After Expiration Three Days Before/After Expiration One Week Before/After Expiration Two Weeks ...
2
votes
0answers
53 views

Calculating effective shop inventories (SQL)

This is an SQL version of that question. Shops and groups The problem domain is a collection of shops (identified by an int shop_id number) each of which is ...
3
votes
1answer
9k views

Basic object-oriented PHP login, logout, and registration scripts

I am new to OOP in general and have recently started trying to develop object-oriented PHP code instead of relying on a primarily procedural style, as this is a requirement for my studies. One part of ...
0
votes
1answer
220 views

PDO insert data through transaction method

I have an import books function to insert more than 5000 rows at once, I did some research and did this one but some other places I saw a different kind of methods to insert without looping and ...
0
votes
1answer
76 views

insert multiple tag

I have 3 tables such as books, tags, book_tags. my objective is to insert books info along with tags (tags can be multiple or single). I have two methods one is insert books info 1st and then add tags ...
2
votes
1answer
96 views

Model database for contract renewal

I have made a contract renewal system in Symfony and Doctrine, and it works, but I think it can be improved, but I make too many requests to the database. These are my models: ...
1
vote
1answer
69 views

HTML file with a submit form

I have an HTML file that contains a submit form, which asks the users the fill in their personal info: then it will post and store into the DB by method of PHP SQL: ...
4
votes
2answers
58 views

Pulling log messages from a MySQL table

I want to get this code reviewed for a function I wrote that pulls log messages from a MySQL table: ...
2
votes
0answers
717 views

Async/await Mysql wrapper

I used MySQL, but it was inconvenient so I made a wrapper. It works, but I'm unsure if there are any issues. Used node module - mysql2, bluebird sqlWarpper.js ...
-1
votes
2answers
109 views

MySQL select between MAX-n1 AND MAX-n2

I just made this link please check this out Online Results I need to select data between 2 values from a table by using MAX because each SID has different VID. My code: ...
4
votes
1answer
481 views

PHP Application layers

I'm dealing with design layers of an application. Basically what I've so far are: Business Architecture: Client-Server Techonologies: PHP+MySQL, HTML5, JS, 3rd parties APIs My app Data Sources: ...
10
votes
1answer
223 views

Science Fiction Wall of Fame (Shame?)

I have a few of hobbies, one is reading science fiction and fantasy and another is coding solutions. I thought I might have a chance to combine both hobbies on this project. I have well over 1500 ...
1
vote
0answers
61 views

mysql query for color/size filter PHP takes time to load

I have an online shop on a custom PHP platform and I have some difficulties on optimising the color/size filters. At the moment it takes 30 seconds to return the query. You can test it here (the page ...
0
votes
1answer
90 views

Cross-platform MySQL database backup using mysqldump

In a Laravel (PHP framework) project, we implemented a backup feature - backing up user-generated files and database tables. What we've searched so far, the best solution in backing up mysql database ...
2
votes
1answer
2k views

Fetching categories and subcategories from database

For a small blog with a limited count of categories, I wrote this code to fetch categories and subcategories from the database. I used a recursive function to call all categories and sub categories , ...
2
votes
1answer
52 views

Joining tables by skipping the intermediate parent table [closed]

We've tables adm_app, quals_data to which personal_data is a parent table. We are retrieving ...
3
votes
0answers
1k views

Full text search for multiple words using Laravel and MySQL

I'm using Laravel 5.6 and MySQL. I need to search multiple columns for a single word or multiple words (e.g., "camhandle", "cam handle"). The way I was originally doing it was just using ...
2
votes
0answers
40 views

Counting distinct number of items in multiple group by query efficiently

I have the following query that counts the number of vessels in each zone for each week: ...
2
votes
0answers
43 views

Breaking down retention metrics

Does this code calculate the retention rate per acquisition channel correctly? $$ R = \frac{E - N}{S} * 100 $$ Where \$E\$ is the number of customer at the end of a period, \$N\$ is the number of ...
1
vote
1answer
113 views

PHP Login and registering system

I am currently learning PHP and decided to write a login and registration system to learn about error handling, mysql, password hashing and basic queries. I know there's standard authentication ...
2
votes
1answer
49 views

Use parameter to filter results in a database without directly allowing users to access database

So background context: I wrote this script for a personal project that holds a large amount of items, I already display and am able to filter the results based on its country/location. I am a student ...
0
votes
1answer
2k views

Parse xml and store into mysql table in python [closed]

I have written the code that retrieves the data from XML file using xml.etree. Is there any best way to store the data into database by parsing an XML file. My code: ...
3
votes
1answer
2k views

PHP > 7.1 - MySQL Session Handler Class with some built-in time-management/security

I've created a class that implements the native SessionHandlerInterface (with added PHP v7+ functionality) while adding some minor security features. My main goal was to maintain native methods for ...
6
votes
1answer
2k views

Fastest way to insert rows in mysql vs sqlserver (large dataset)

I'm looking for any possible improvements that could be made to run the mysql piece of code faster. I created a simple test winform application that creates two docker databases : Sqlserver on linux ...
3
votes
2answers
475 views

Secure PHP login with SQL injection prevention

I am working on a project where users have to log in then if it is correct it creates a cookie to process requests. I would like to find a way to auto-renew sessions every day without affecting the ...
2
votes
1answer
48 views

Comparing data in SQL using foreign keys

The following is given: ...
6
votes
1answer
3k views

Role Based Access Control (RBAC) System

I have been working on creating my own implementation of an RBAC system for the purpose of: learning to use an OOP approach instead of procedural switch from using mysqli to PDO and to learn how to ...
4
votes
1answer
75 views

Auto-updating offers

I wrote PHP script to auto-update offers from provider API in my database. Unfortunately, by performing the following queries in the foreach loop (following the API records), the load is at 99% of the ...
4
votes
1answer
462 views

Bash script to replace string in database

How secure is my script? ...
3
votes
1answer
35 views

Handling download requests using PM2

I Using Nodejs v9.10.1 for handle download operation from another application. When using PM2 in fork mode to make alive my code. After 50 minutes, this will show high memory usage. Server Config is ...
5
votes
2answers
696 views

Converting a query result into an key=>value pairs for a lookup table

My app has a number of lookup tables stored in a MySQL database that are used for various purposes such as a select element. Unfortunately, the query results aren'...
11
votes
3answers
673 views

Secured registration script

I created code for my registration form on my social network. I want to know if it is secured enough to release on the web as a public social network. Also, all of the code works. I just want to make ...
2
votes
2answers
91 views

Methods to search for a client in MySQL by ID or by phone

I have this code that returns a client object, but to do it I use two methods. How can I improve this to be more efficient and ensure it meets common standards? ...
1
vote
0answers
43 views

Nightly script to update database

I have a portion of a script here, and the whole script works just fine. However, I feel like it's inefficient and may work better in a class/function format. This is a script scheduled to run every ...
1
vote
1answer
53 views

Insert and update SQL entries for posts to be accessed by up to 3 other users

At first, I have this HTML I use here: body { text-align: center; } ...
1
vote
2answers
341 views

MySQL database wrapper

Here is a wrapper to a MySQL connection. First I have a DatabaseController and then a DatabaseConnection. How I use this is ...
2
votes
2answers
95 views

Nginx-WordPress installer for Debian

I have written the following Bash script which includes an Nginx WordPress bootstrapper: A program establish WordPress apps fast on a Debian-Nginx environment. It utilizes CertBot for HTTPS, SSHguard ...
11
votes
1answer
79 views

Python RPI button board

My project consists of a Raspberry Pi 2B V1.1 connected to a number of push-buttons via GPIO pins. The goal is to create a panel of buttons, allowing the user to make a selection of one or more items ...
3
votes
1answer
70 views

Compute leaderboard of competitive riders throughout a season

I have a table in my DB that contains Riders as rows and their points throughout the season as columns. Here are the columns: ...
2
votes
3answers
2k views

Connection to MySQL database

I'd created a C# class to connect to a MySQL database (Connection.cs) and a separate class for the user validation (User.cs). Connection.cs ...
5
votes
1answer
2k views

VB.NET class for MySQL CRUD

I've been using this code in a few basic CRUD (Create, Read, Update, Delete) applications, but I think it can be improved and refactored. I have 3 SELECT type functions(return a table, return a value,...
5
votes
1answer
1k views

Simple URL shortener

This URL shortener is just for my own use and it runs on my local machine. I created this for fun and I doubt if I would ever use it in production. Is my script any good? shortener.php ...
7
votes
3answers
1k views

CRUD operations for a contact list using PyMySQL

I am from Java background, learning Python. Please review my code and guide me to learn Python properly. This is a sample code to perform all CRUD operations of contact app. ...
2
votes
1answer
75 views

Insert contact information from form fields into MySQL database when button is clicked

I am just a beginner trying to do my due diligence and research things properly. I am trying to go about the correct way of adding data into a database. I have read articles on the following: Not ...
0
votes
1answer
40 views

MySQL CLI: Create a MySQL user & DB

Please review my Bash code to create an authenticated, all privileged MySQL user plus a DB with the same name, through the MySQL CLI: ...
1
vote
2answers
63 views

SQL to find users that the current user hasn't liked/disliked

I have this really long query, which in my opinion looks ugly next to all the tidy code in my project. I was wondering if there was a way to optimize it or make it shorter at least: ...