The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
2answers
180 views

Program for entering 1000 random numbers into two different databases, one for odd numbers and one for even

I have created a program in java for entering 1000 random numbers into two different database one for odd numbers and one for even. The code is executing fine but it takes nearly a minute to execute. ...
0
votes
2answers
66 views

Creating website via SQL table and PHP object

I wanted to try keeping the content of a website (mostly) in a SQL table and have made the basic template for the body. Set the $pageName and include this template....
4
votes
1answer
2k views

Connect to MySQL and fetch a list of customers asynchronously using C#

I am connecting with a database and returning values from a Web API controller. For better performance, I am doing it completely asynchronously with a new task. Am I doing it the correct way? Am I ...
4
votes
1answer
4k views

A Discord bot that connects to a local database (OOP)

I am currently working on a Discord bot as a way to learn and practice Python. I have been trying to learn object-oriented programming, and apply the "don't repeat yourself" principle. The code ...
1
vote
1answer
61 views

Basic quest code in PHP

I'm a beginner in PHP and I would like to know how to make a good quest system. What is the code for : This code is to accept quest. It show the quest and where the user is in the quest (Ongoing, ...
3
votes
2answers
1k views

Multiple methods to connect to MySQL and execute a query

The Code ...
0
votes
2answers
361 views

Save to a MySQL database a temporary row with all information about a receipt

The Code The Save Function: ...
0
votes
1answer
1k views

Upvote and Downvote using PHP and and AJAX

I'm trying to implement upvote/downvote system.The user clicks on the upvote or downvote button its triggers the AJAX code the votes is inserted or updated in the database. This triggers AJAX request ...
2
votes
2answers
8k views

Transaction in spring boot

I am using spring boot in my application. ...
1
vote
0answers
28 views

Code beautifying for dynamic coding to create triggers (Audit Trail)

I'm interested in all kinds of code enhancement, but I split my audit trail project for MySQL in smaller snippets. In today's snippet I want to concentrate on the ugly code I've written: a script ...
4
votes
2answers
92 views

C daemon to perpetually cache data from an external API

Background My task is to create a program to continuously download utility meter data from an external API, and cache it in a MySQL database for faster access. The performance of this program is ...
1
vote
2answers
124 views

Session Control

I am implementing my first app using MVC. I would like to know if the approach I thought for the session system is a good and scalable one. Well, basically a session is stored in my MySQL database ...
-1
votes
2answers
98 views

Practicing Java servlets, MySQL and JSON - follow-up

(See the previous iteration.) What's new I have incorporated all the points of Dmytro Maslenko's answer. My code seems a little bit tidier. Code AddPersonController.java ...
1
vote
1answer
568 views

Practicing Java servlets, MySQL and JSON

(See the next iteration.) Introduction This is my attempt at a simplistic web application just for the sake of practice. I have three main servlets: ...
5
votes
2answers
118 views

Determine number of times an id was used with a domain IP

This is a slow query and the table has 50 million rows. Table named 'log': ...
0
votes
1answer
119 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 ...
2
votes
0answers
276 views

MySQL Schema for Tag System Works, But Can It Be Better?

I'm working on system that tags images. I'm going to use the xxHash (lz4) for hashing images. With hashes of size 64 bits, it looks like I won't have a 50% chance of a collision until ~4 billion ...
1
vote
1answer
56 views

MySQL queries to select messages related to a user, using UNION vs. OR

I'm just wondering if there is any improvements that can be made on my queries, as i've looked around and posts are saying to use UNION ALL instead of ...
0
votes
1answer
105 views

MySQL query to select messages related to a user

Could someone please check my query and the table structures and let me know if there is any way to improve it. I would like some tips for my own personal development Query in PHP: ...
2
votes
0answers
26 views

Filter table with drop down values given multiple constraints

I have a table that stores drop down list values. The table looks like this: ...
1
vote
0answers
112 views

Fetch key from MySQL DB if doesn't exist in redis DB

This code gets data from a MySQL database, such that if a key doesn't exist in a Redis database, then fetching of data needs to be done from the MySQL database and then stored in Redis cache. As such, ...
0
votes
1answer
63 views

Link shortening script

I wrote this script for a link shortener just for fun. Is it safe, or is it very easy to inject SQL have other security shortcomings? Also, do you have any tips against MySQL injection? I don't know ...
0
votes
1answer
58 views

Clean up PHP & MYSQL code (Picked up by Swift as blog reader iOS app)

New to PHP and was just wondering if any improvements can be made, maybe increase efficiency or just clean up code? I know I'm using an old MYSQL maybe we can update it. Just want to make sure the ...
3
votes
1answer
3k views

MySQL queries with try-except error handling

I have this function that I have written, that gets passed a row of data from a mysql function. The function then uses a try-except block to get some a list of values depending on a value within the ...
5
votes
2answers
674 views

MySQL parser written in Python3

As the title suggests, I'm building a MySQL parser in python. The intention of this is to better support application development by managing migrations in a more declarative way. You can read about ...
0
votes
1answer
775 views

PHP MySQL make insert and update large amount of users faster [closed]

I'am using php on server side to manage data with MySQL. I have to request a API that gives me an list of users. I need to check for each user if he is in the database. If yes, I update his ...
1
vote
1answer
705 views

“Live” searching on a website using AJAX and PHP (MySQL/MariaDB database)

I have written a "live" search feature for my website. Whenever a keyUp event is triggered in the search field, the JavaScript performs an AJAX request to a backend ...
1
vote
2answers
563 views

Validating a search string for an SQL text search

Is it safe to allow these special characters when validating a string? The user is currently allowed to send alpha numeric and the following special characters from the browser: ...
3
votes
1answer
179 views

Query to determine insert / update operations to synchronize data

I've been developing a system where the mobile syncs data from the server.The phone can run offline but when connected to the internet it needs take care of inserted or updated data. Here is the ...
5
votes
1answer
263 views

Web-scraper for housing web

I've made a program that scrapes a famous spanish web of housing ads. The program is formed by two big classes: a Manager, that goes through the list of ads and saves their links in a list, and a ...
3
votes
1answer
38 views

Adding multiple datasets to single table

I have a table1 in DB1 which is similar to the following ...
1
vote
1answer
421 views

Laravel query to select photo orders related to some competition

I'm using Laravel and I have one monster query that returns exactly what I need, and runs perfectly on my dev machine, but on production runs extremely slow and I get timeout errors. Here's the query:...
2
votes
0answers
421 views

C# MySQL Database Library

Below is a database manager and a class called database connection. The database Manager controls the database connection string and generates a new database connection when you need one. I'm looking ...
1
vote
3answers
133 views

PHP database calls

I need help to speed up this code. It works, but is really slow (updates 2 items/second). Any tips on how to speed it up? The script functions like this: Break up an email to username and domain If ...
0
votes
1answer
59 views

Update table with greatest value from itself and another table

I have two tables A and B with some data and a date (e.g. date of last update). The id is only unique in table A. I want to update table A with the last date (=maximum) for each id. Table A: ...
3
votes
1answer
397 views

Select items between two dates that are available

I wrote this MySQL query, but I feel it could be better. I had to get all clients between today and 14 days' time, that have at least one day "free". I have a SQL Fiddle, and there you can see how my ...
0
votes
1answer
2k views

PHP/MySQL to delete data from 4 different tables at once

I have four mysql tables setup like the following: ...
0
votes
2answers
58 views

Stateful User tracking

I have a class that takes a string or an integer, which stand for username or user id in the database. I am not comfortable with my constructor taking "a string or an integer" and want to modify it ...
4
votes
2answers
661 views

Inserting users using PDO prepared statements

I made a small script to update fields in a database. I'm using PDO to connect to MySQL. All the business logic of PHP is in the top half of the file, and the form is at the bottom. Here is the full ...
4
votes
1answer
2k views

Create SQL statements from CSV file for creating a MySQL table

This program reads in a CSV file's header row and writes out SQL statements to a .sql file that can be used to create a new table in a MySQL database and load the data into it. If anyone can offer ...
5
votes
1answer
484 views

NodeJS/Express/socket.io backend

I have the backend of a socket.io script running in NodeJS for a web application. A user can login to the site and join a project collaboration (group of users linked to a project). Each project has a ...
4
votes
3answers
10k views

Inserting 100000 records to MySQL takes too much time

I'm using spring boot, hibernate any MySQL for reading 100000 records from csv file and write the same to the database. I'm doing the batch insert where the data is committed at intervals equal to ...
2
votes
2answers
370 views

Loading CSV into MySQL using OOP PHP

I need to make a simple CSV->MySQL script in OOP and I was wondering if there's anything I am doing wrong in a object-oriented sense. I have a file name db.php where I connect to MySQL via MySQLi and ...
4
votes
2answers
648 views

Loop through database and run shell commands with Python and exiftool

Briefly, I'm looking at getting the code below to execute faster. I have 100k images to go through. I'm running a query against MySQL, looping through results and then running exiftool against an ...
3
votes
0answers
57 views

A function that debits a virtual wallet and calls an API to disburse to a real account

I am trying to determine if there is a better way to handle reversals for this function. This is how it works: A user inputs in amount, bank, and account number this would be used to debit his ...
1
vote
1answer
85 views

Sending email notifications, each to a different set of subscribers

Here is a code which sends email notification on new comments. ...
2
votes
0answers
160 views

Concurrent AWS S3 copying of images listed in MySQL

I created the following one off script and it did the task quite well (1000s of requests / second with low CPU usage - outperformed the previous python script in every aspect). But I am wondering if ...
1
vote
1answer
78 views

Changes quantities that are displayed in a shopping cart page

I'm fairly new to PHP and am following e-commerce tutorials. When exploring a way to resolve a problem I had with a PHP code block, I came upon a post another person had with the same code block. The ...
5
votes
2answers
48 views

Displaying user scores

I have started teaching myself MySQL and created a simple application which asks for user input stores it and displays it. Can you guys please let me know if there is something I am doing wrong or any ...
2
votes
1answer
52 views

Handling Queries with Custom Classes

Once a project gets bigger than a couple pages you don't want to have to call up every single page and do find & replace every time there's a change in the database structure. At least, I don't! ...