Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mysql]

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

1
vote
1answer
70 views

Edit database content with a web page

I'm new to PDO, and I want to make sure I made this in the correct way. This way is working, but I have a feeling it's unclean. I have this input: ...
-4
votes
0answers
25 views

mysql range MAX() - MIN() [on hold]

I have this sql statement. MAX() - MIN() What the statement does is takes the range of the surface mass of each country and creates the range (MAX -MIN). Feel free to comment if you have a better ...
-2
votes
0answers
24 views

Calculate percentage of the Frequency with mysql [on hold]

I am looking to improve my sql statement. Is there a better way to write the following code? The statement is showing the percentage of the frequency listed in the table below. The frequency counts ...
2
votes
4answers
115 views

using $_POST array to prepare PDO statement with variables

I have been developing a little, private Blog Site to make notes/ stories of pen and paper rpg games available for me and my players. This is my first project. As I am new to coding in PHP and MySQL ...
0
votes
1answer
42 views
-1
votes
0answers
13 views

NodeJS: unique GET multi-table function and layout table

I'm bored to generate functions for different tables, then I started to summarize everything to 1 function, but I am a junior programmer, I hope to find opinions about my code. This is a short ...
0
votes
0answers
7 views

Dynamic Statement Executor

I've written a stored procedure in order to simplify the process of calling dynamically constructed MySQL statements: Implementation ...
0
votes
0answers
6 views

Double Entry Accounting Schema [migrated]

Setting up a double entry accounting system for personal use and to help manage a really small business. Trying to put a few features that seem relevant now. I'm just starting to learn about DB/...
1
vote
1answer
66 views

Auto generate database table

I have written my own little auto-generated table class, and I was wondering if you guys can give me some tips on how to make this code more elegant and secure and maybe compact it so I use only one ...
3
votes
0answers
19 views

Automatically generate TypeScript classes from database tables

Made a project to generate TypeScript classes from database tables, and I'm looking for input if the code is reasonable. pg and ...
0
votes
0answers
13 views

MySQL EAV structure and query

I have designed a EAV table structure as follows: ...
-5
votes
1answer
52 views

How to write SQL in a industry standard style [closed]

Here are the commands I ran to start setting up a database I need. ...
1
vote
3answers
117 views

PHP script security for new user registration

I would like to ask the experts here if this is secure. If it is not can I get an explanation as to why it would not be secure? I have been reading off and on on sites for this and I have trouble ...
1
vote
1answer
52 views

Scrape data from a webpage and store them in a database

I've written a script in python to parse different names ,bubbles and reviews of various ...
1
vote
1answer
34 views

Calculating COUNT(*) of a MAX() + GROUP BY query

I have a SELECT query I'm executing which has a MAX() column and a GROUP BY clause, and in ...
1
vote
2answers
59 views

Merge both sql queries into one to get the performance

Currently i am using 2 queries - one for reattemptdate & one for holddate.... if we merge both queries & get the results in single query , than will it give better performance? if so how to ...
0
votes
2answers
66 views

Tracking employee data

We have hundreds of employees and for tracking each employees' data, and I am using this code: ...
1
vote
0answers
30 views

Implementing an In-house Badminton Ranking System

I am working on a project and wanted to have a quick look by you people if the schema or query needs some changes or does it totally needs to be changed. The project is about creating a ranking ...
2
votes
0answers
49 views

One class for MySQL and MSSQL Queries

EDIT BELOW I am trying to create resusable classes for MSSQL and MySQL queries (later also Update and Delete queries). I tried it doing the OOP-way. Here is my result: Einstellungen.vb: ...
1
vote
1answer
135 views

MySQLConnection Conn.Connect()

I'm pretty new to working with databases, and I would like to know if I've made some common, major design flaws in my implementation. For context, the whole project is intended to be used by a single ...
-3
votes
1answer
50 views

Is there a different way of implementing this program without using nested while loop? [closed]

Presently my program is working properly, but how do i implement this program without using nested while loop(one while loop within another while loop).This is a kids way of programming and my office ...
2
votes
0answers
58 views

Exporting tables from 30 databases

What my code do: Connecting to 30 DB (consistently) Copying DB file to temp.dat Reading temp.dat Writing read data to file So, it connects 30 times with different databases. This take 6-7 second (...
3
votes
2answers
182 views

Using Python to create a JSON file of recipes from MySQL

I needed to create a JSON file from a couple of MySQL tables to migrate some recipes from wordpress. This was my first time writing a script in python and would like to get some feedback on what I ...
1
vote
2answers
48 views

Encoding multiple rows from prepared statement in php [on hold]

I have this code that hypothetically returns multiple rows from a database and encodes them in a JSON. I am wondering if this is the best and most presentable way to do it. Note: I am using msqli ...
0
votes
1answer
82 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
45 views

3 tables in SQL [closed]

Lets say i have 3 tables: users, posts and comments. ...
0
votes
1answer
51 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
32 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
43 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 ...
1
vote
1answer
556 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
55 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
0answers
25 views

Querying 2 or more tables with joins or eloquent relations

I have few tables that store the details of educational content within a school. Tables' descriptions viz. A grades table stores all grades, subject table stores all subjects, ...
0
votes
1answer
56 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
82 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
65 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: ...
3
votes
2answers
45 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
159 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
100 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
205 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: ...
7
votes
0answers
68 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
49 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
61 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
636 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
35 views

Getting marks without getting personal

We've tables adm_app, quals_data to which personal_data is a parent table. We are retrieving ...
3
votes
0answers
537 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
34 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
35 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
83 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
27 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 ...