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
-3 votes
1 answer
40 views

Database design for a recommendation system [closed]

I am new to databases and I am trying to design a database for a project that I am currently working on, so I wanted to know if this design is good or not. knowing that the database should serve a ...
user avatar
  • 35
0 votes
2 answers
153 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&...
user avatar
0 votes
1 answer
97 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 ...
user avatar
2 votes
1 answer
69 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 ...
user avatar
  • 21
3 votes
0 answers
69 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 ...
user avatar
3 votes
1 answer
36 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 ...
user avatar
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 ...
user avatar
2 votes
1 answer
509 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 ...
user avatar
  • 137
1 vote
1 answer
95 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 ...
user avatar
  • 127
0 votes
0 answers
38 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 ...
user avatar
  • 31
-3 votes
1 answer
43 views

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

...
user avatar
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? ...
user avatar
1 vote
2 answers
59 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 ...
user avatar
  • 11
0 votes
1 answer
134 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 ...
user avatar
  • 27
0 votes
0 answers
65 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 ...
user avatar
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() ...
user avatar
0 votes
3 answers
73 views

table name column name from GET parameter

This is a function that reads a setting data from DB. ...
user avatar
2 votes
1 answer
114 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 ...
user avatar
  • 21
0 votes
3 answers
86 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 ...
user avatar
1 vote
3 answers
170 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 ...
user avatar
  • 119
0 votes
0 answers
39 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 ...
user avatar
0 votes
0 answers
37 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 ...
user avatar
2 votes
1 answer
63 views

Calculate of the average of time discounted values

Given the current table: ...
user avatar
  • 133
4 votes
0 answers
440 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 ...
user avatar
0 votes
2 answers
67 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) ...
user avatar
7 votes
3 answers
446 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 ...
user avatar
  • 71
7 votes
2 answers
122 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 ...
user avatar
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"...
user avatar
  • 101
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: ...
user avatar
  • 25.3k
0 votes
1 answer
65 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 ...
user avatar
  • 25.3k
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. ...
user avatar
3 votes
3 answers
76 views

Order a table by column and get row number

In my database, I have table wp_postmeta, example: ...
user avatar
0 votes
4 answers
113 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 ...
user avatar
  • 177
1 vote
1 answer
67 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,...
user avatar
  • 177
2 votes
3 answers
123 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 ...
user avatar
  • 53
3 votes
2 answers
164 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 ...
user avatar
1 vote
1 answer
346 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. ...
user avatar
2 votes
0 answers
45 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 ...
user avatar
1 vote
1 answer
74 views

PHP function that clones HTML form structure to MySQL database structure

I built a function that should greatly simplify working with long HTML forms, that save data to MySQL using PHP. My forms usually have several hundred input elements that are added / altered / removed ...
user avatar
  • 141
4 votes
2 answers
171 views

Using a transaction to create account records

This is my first time using commit and rollback. I just need to know if this is a proper execution of the functions for this particular situation: ...
user avatar
1 vote
1 answer
44 views

I have a query like this that seems complicated and I want to do it by using Java Stream Api

I have method that fetches sorted and filtered data from Mysql Database, Firstly I had done It by using Java. Now I did it by Mysql but I don't like the way the code looks I have entity that named ...
user avatar
1 vote
1 answer
62 views

Calculate course module credits from individual assessment scores

I'm currently working on a grade calculator for a university (professionally), and I am wondering if anyone can suggest an improvement to the following query? Here is my database: The query returns ...
user avatar
2 votes
2 answers
88 views

Dapper with shops and payers

I live in the buildings that have 50 people in it and for each floor splits into 2 groups each group is from ~9 people. I'm trying to build an Xamarin app (IOS, ANDROID ,Win10,maybe web app) to make ...
user avatar
2 votes
1 answer
339 views

MySQL database custom session handler using PHP with MySQLi extension

I have made the decision to move the storing of session data to the database. Any new ideas, suggestions are welcome. Please also give security suggestions. Like SQL injection is possible here, etc... ...
user avatar
4 votes
1 answer
116 views

Storing and confirming user input

I am a beginner, and I'm trying to secure a sign-login system on my website. Is my code good/enough to prevent SQL injection? THIS IS THE SIGN FILES This is the index.php that takes user input: ...
user avatar
  • 163
3 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 ...
user avatar
0 votes
1 answer
64 views

Entity Relationship Diagram for Grade Calculator

I was wondering if anyone would be able to review my Grade Calculator for a course ERD? I'm looking for ways to improve the current design (if any improvements need to be made that is) and if anyone ...
user avatar
1 vote
1 answer
100 views

Web scraping cars

Is there any way to lower the lines of this code and make it better in terms of being more Pythonic? The program collects data from truecar.com and then puts them ...
user avatar
  • 183
2 votes
1 answer
41 views

PHP filesystem on a shared file system

I have a project which we need to migrate from an on-prem solution to the AWS cloud. Currently, the software is running on a single instance. It's working fine but the business want the software to be ...
user avatar
2 votes
2 answers
87 views

Inserting data into MySQL

My code currently doesn't insert data into MySQL fast enough. However I don't know how to measure the current speed. ...
user avatar

1
2 3 4 5
23