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
4 votes
1 answer
1k views

Login system using bcrypt and MySQL, to be used for any future projects

Main function will ask what the user wants to do. LoginSystem class will handle the sign up and login process as well with the checking if password is right. passwordHashing will use bcrpyt to salt ...
0 votes
0 answers
73 views

SQL employee database querying Questions

SQL employee database querying Questions Consider the employee database of an organization XYZ private limited ...
3 votes
1 answer
210 views

Get future events from Pinnacle API

My program makes API requests to Pinnacle Sports to retrieve future events and saves them to the database. Questions: Do I manage the database resources correctly? It takes about 3 seconds to check ...
2 votes
1 answer
176 views

Email ticket system

How better to refactor nested if-blocks? ...
3 votes
1 answer
77 views

Proper PDO connection function

I am reviewing the database class for a live website. I am not sure if the current connect function is the best way to create a pdo object as it appears to create a new connection every time it is ...
0 votes
2 answers
165 views

Version 2: Display visitor's number on your web page (changed code after getting answer for first version)

Version 2: Display visitor's number on your web page (changed code after getting answer for first version). The first version is here: Display visitor's number on your web page The "visitors&...
2 votes
1 answer
516 views

SQL query to find expenditures of employees who have exceeded their limit

I've 2 tables emp and expenditure. Emp: ID, NAME Expenditure: ID, EMP_ID, AMOUNT Each emp has a limit of 100 that he/she can ...
3 votes
1 answer
37 views

MySQL procedure to extract a letter from a phrase

Create a function called GETLYRICS, which will receive as parameters a word of at most 15 letters and a number. It must return the letter of the position indicated in the number. My exercise is fine ...
2 votes
1 answer
2k views

Separate areacode from phone number string with MySQL Database

I have a database with 5000 entries of local area codes to separate the area code from a phone number string. I'm not sure if the code I use is the fastest way to solve these job. I shrink the ...
0 votes
1 answer
104 views

Display visitor's number on your web page

Display visitor's number on your web page. The "visitors" table has only one column (visitor_count) and only one row. The column's initial value is 0. I know goto should not be used but then ...
4 votes
0 answers
72 views

A procedure that receives a letter and a number that shows for example : (A,3) A AA AAA

Make a procedure called paintletter, it receives two parameters, a letter and a number. it will have to paint on the screen lines with the specified letters starting with a letter and ending with as ...
1 vote
1 answer
98 views

Optimization of laravel pivot table relationship

I have a pivot table called invite_riskarea which is designed as follows: This table handle the permissions that have a specific user (through an invite id) to ...
3 votes
3 answers
77 views

Order a table by column and get row number

In my database, I have table wp_postmeta, example: ...
0 votes
0 answers
31 views

Extract the divisors between dividing and divider

It turns out that I have to do a procedure called THEDIVIDERS which receives two numbers for parameters, in my case the parameter 1 is by dividing and the second divisor parameter. Statement : Make a ...
0 votes
2 answers
173 views

Displaying MySQL data using PHP

I have MySQL data that I am rendering in an HTML table using PHP. This is the full code of my table and PHP. It does output fine and looks how I would expect but I am wondering if there is a better ...
0 votes
0 answers
40 views

REST API server with Typescript, Node.js, express.js and MySQL: A few questions

I'm developing a Conway's Game of Life / generalised cellular automata simulation app for Android using React Native. One of the planned features will be the ability for users to access a catalogue ...
1 vote
0 answers
37 views

Calculate time interval excluding breaks

I have a solution for a question I asked on SO: I am trying to create a database where I also need to find the time difference inside a record. However, timediff() ...
-3 votes
1 answer
43 views

How to select lots of friends posts from database [closed]

...
1 vote
1 answer
21 views

Shell script to backup db from mysql whether the mysql server is running in docker

I have written this shell script to backup MySQL database to disk. It works fine but I am not well proficient in shell scripting. So what do you think can it be improved? ...
1 vote
2 answers
60 views

Having trouble deleting multiple queries (PHP, MYSQL)

I'm having trouble making WHERE IN query work, I was only able to make it work as a foreach loop. My payload looks like this: sku[]: BOOK0002 sku[]: BOOK0003 My ...
1 vote
3 answers
98 views

Delete companies with the least number of flights

I have solved the task of Delete the companies that made the least number of flights. the visual table diagram is here. The exercise is here This is my source code -it's "arrow antipattern"...
0 votes
2 answers
119 views

PHP search multiple filter inputs

Okay so I built this search page that searches for posts but my current code seems so bloated and inefficient. My script(search page) ...
0 votes
3 answers
116 views

url encoding and storing (JS, PHP, MySQL) [closed]

This question is about how best to encode, send and store information between JavaScript, PHP, and MySQL I am doing a GET request from HTML/JavaScript to my PHP server, which is then storing the data ...
1 vote
3 answers
172 views

SQL query joining applications to categories

I do have large database and my query takes about 2s to complete on production environment which is kinda slow and would like to ask is there a space for improvement? My initial inputs are ...
4 votes
2 answers
185 views

Security of post submission, picture upload and post fetch

I am a newbie and have been following a tutorial I bought on Udemy. But I was told it is old and teaches bad code practices. I used this in some code from my old projects. Now I'd like to know how ...
0 votes
1 answer
136 views

Is this session manager secure?

I'm looking for best practices for writing secure session managers. I'm making a table for the authorization token (UUID OR GUIDv4) with autoincrement, user_id, token, status (enum) then update status ...
0 votes
0 answers
69 views

Validate avatar image

I want to know if that code is correct and readable. In class avatar, I make validation. I check if the field is not empty and if the photo extension is correct. If not, an appropriate exception is to ...
0 votes
3 answers
75 views

table name column name from GET parameter

This is a function that reads a setting data from DB. ...
2 votes
1 answer
125 views

PHP OOP: Configuring MySQL DB & query w/ Twig

I decided to up my PHP game and learn some OOP. I am re-building my website from procedural to OOP, but since I don't want to use a full framework I fiddle with some components. As a router I use ...
2 votes
1 answer
63 views

Calculate of the average of time discounted values

Given the current table: ...
1 vote
2 answers
464 views

Laravel time-punching database structure

I am trying to build a database structure for a time punching system. What I'm trying to figure out is if what I have is the ideal structure, or if something else exists that I'm overlooking. I want ...
0 votes
0 answers
40 views

Adding more fields to a Questionnaire in a CRUD system

Background on Project When a customer orders a machine, I have to do something called a telephone site survey, which involves asking them questions about their site making sure everything is okay ...
0 votes
0 answers
40 views

Create trigger that updates Table3 from an insert into Table1 that multiplied by a value in Table 2 in MySQL

I know this is probably more complicated than it needs to be, however, I would really appreciate some help. I'm trying to create a trigger in MySQL that will update the value in the Costs table when a ...
4 votes
0 answers
519 views

Student report card management Python program

The program is designed to take data from a MySQL database, using mysql-connector-python, and print it as a table in Python using the texttable module. The program also plots charts based on the data ...
7 votes
2 answers
126 views

Connect to MYSQL database in PHP with prepared statements

I have recently learned about using PDO. I created a db class which could handle common actions like create, update, delete and select. Is this method a correct way to connect to the database using ...
1 vote
1 answer
73 views

Reduce database touches for one to many data pull

I have the following function which works properly and returns all of the rows from a specific table, then loops through each row to add data related to it as a subarray. ...
2 votes
2 answers
130 views

Shoutbox system

I wrote a little Shoutbox System which is working fine, but I want to know if there is something I can improve about this code. Here is my Shoutbox Overlay: ...
0 votes
1 answer
52 views

A Java EE7 web application for counting views in a static HTML page - follow-up

(See the initial and previous version.) This time, I have incorporated all the good points made by mtj. See what I have: ...
7 votes
3 answers
468 views

Schema design for user profile and transaction

I'm creating a schema design for a user profile and transactions. I am very new in data modeling and currently this is my design. The schema has multiple deposit ...
7 votes
1 answer
13k views

SQL database for a social network

I'm trying to create a mini social network mobile application kind of like Instagram and I'm not sure about my database organisation, it feels like something is missing, especially with the ...
0 votes
1 answer
67 views

A Java EE7 web application for counting views in a static HTML page

I have this blog lurking around in the web. It's just static HTML, but I was interested to keep track of all the views on that blog. Finally, I end up with the following web application: (The Java ...
0 votes
0 answers
18 views

Database operations classes and currencies class

I work on a project that is dealing with two databases (Mysql Db on Internet + Sqlite Local Db). I will explain what I do with my project to build the codes: firstly I have (Class "ClsMysql"...
0 votes
0 answers
20 views

Trying to secure a payment transaction with mysqljs2

In my web app, I am trying to secure a payment transaction, that is: prevent users spending more than they have, especially in the case of concurrent execution and prevent partial execution. ...
0 votes
4 answers
117 views

Appointment database - design II

I want to create a database which gives an admin user ability to create schedule for other users to book from. This is second edition of this database schema. I would like to know if there are any ...
2 votes
3 answers
125 views

Is this method for loading data in a C# application recommended?

Goal I'd like to understand if this current method, of loading data and inserting data into a database I currently use is to be avoided? Code I drafted a simple application that loads data and inserts ...
1 vote
1 answer
71 views

Appointment database design - Schema

How would you go about designing a database for service appointment? Here is what i came up with so far. Let me know if there is a better way. Basically the admin should be able to build services list,...
3 votes
2 answers
178 views

OOP - Contact Form PHP Backend - Procedural to OOP - Dynamic MySQL Prepared Statement PHP

I just converted procedural code to OOP code. Is there any performance or security issue with this code or what should I consider further? interface ...
55 votes
2 answers
59k views

Class for reducing development time

There are many PHP PDO classes out there, agreed. However I find they do not allow for flexibility. So I created one that helps reduce development time as little as it may be but it does the job (...
1 vote
1 answer
390 views

SQL for precision and recall?

I have a table containing two versions of results for some predictors, one by human labeling and the other by machine predicting, and I want to calculate some metrics. ...
2 votes
0 answers
54 views

Python script to collect NWS gridpoint forecast data (JSON) and push it into MariaDB

This script is my first-ever attempt at writing anything in python. Though I have an electrical engineering background and therefore got a little programming education in college, it was fairly ...

1
2 3 4 5
23