MySQL is an open-source, relational database management system.

learn more… | top users | synonyms

1
vote
2answers
69 views

Class for multithreaded insert into database

Here I have class that supposed to take dictionaries of product objects and their articles (kind of unique identifier) from queue and insert or update them in database table. Received dictionary ...
0
votes
3answers
50 views

Looping to update article codes on one server based on queries on another server

I've read somewhere on Stack Overflow that doing queries in a loop is very inefficient. It will hammer your SQL server and make your script very slow. Sample code: ...
3
votes
1answer
57 views

Inserting data into database

I started learning PHP and MySQL, was using MySQL_ functions. Then I learned they are deprecated, had to choose between PDO and MySQL. I chose MySQL and started using it. As I learn OOP PHP, I ...
5
votes
1answer
34 views

Slow query joining orders and products

The end result I am trying to achieve is an array containing the total ordered qty for each product. I have been successful but the query takes about 20 minutes to run and I'm wondering if there is ...
4
votes
1answer
35 views

Fetching objects and adding a calculated field in Doctrine 2

I'm making a section that shows a list of blogs and how many comments it has without loading any comment data. My Blog entity is as follows: ...
5
votes
2answers
34 views

Inserting values of Date type into a MySQL database

I have got a JTable implementing a TableModel interface. There are ID (primary key, ...
2
votes
1answer
21 views

Selecting Timesheets

I'm trying to improve my SQL syntax, take the following for the example ...
4
votes
2answers
195 views

My method of escaping MySQL strings in C++

This is how I'm currently escaping MySQL strings in C++: ...
2
votes
3answers
61 views

A class which represents an SQL table

I'm representing DB tables as classes (in this case PHP classes). This has the goal of modeling every section of the web page, where you will get inputs from the user. My actual base design is: One ...
-1
votes
1answer
47 views

PHP/MySQL: Best way to check if images are identical? [closed]

I got a table where i add user personalia. Additionally I have one picture stored in the filesystem for each record, named after the id of the record like below. personalia table: ...
1
vote
2answers
80 views

PDO class extend

I am moving in to OOP PHP and having some problems extending my database class to my objects. I am still new to the variable scoping in OOP PHP, so if it a tiny syntax error I apologize. If my ...
5
votes
1answer
61 views

TrackDAO: what can be improved?

In this specific situation there is a table with trackdata and a form to add rows. For the sake of clarity I won't include the view-related code here. The added rows are added to a LinkedList when ...
3
votes
1answer
44 views

JOIN and sprintf rather than two queries and echo

It works fine, however it's a little messy. I understand it would be better for performance to use JOIN and have been advised before to use sprintf. However, it's ...
1
vote
1answer
31 views

Web Service implementation on the client

I will be creating a web service as part of a group project for university, which will be developed using Java within the Eclipse IDE. Having no prior experience using web services, I managed to ...
4
votes
2answers
1k views

Possible SQL injection vulnerability searching for a product by ID?

I want to be sure that this isn't vulnerable to SQL injection. If yes, then how can it be improved? ...
1
vote
2answers
45 views

Safety of globalizing config data

I have some framework in PHP/MySQL for developing web services. Finally my code works on two servers - production and developer. My idea is to create one code without differences, which will work ...
1
vote
2answers
50 views

Inserting e-mail subscribers into MySQL

I'm new to Python and I am learning database connections from here. This is the code I am using to insert e-mail subscribers into a table: ...
4
votes
2answers
120 views

Calculator using PHP with logging to MySQL database

I have made a calculator in PHP and I need some feedback in terms of security and performance or any other general improvements. You can download a zip file with all the contents from this link if ...
3
votes
1answer
44 views

Checking if my code is secure

I'm deploying a PHP project, and I always try to use prepared statements, but unfortunately, GoDaddy does not have the mod mysqlnd which I use it for the function ...
0
votes
2answers
151 views

Connecting to a MySQL database with C#

Can anyone help me with checking this code? It is for connecting to a database. The method getFromDatabase is to take values from the database and put it to a ...
2
votes
1answer
29 views

Bash-based MySQL inventory scanner

I am trying to create a bash-based inventory scanner, and was wondering if there is anything 'glaringly' incorrect about my syntax or usage. I was hoping I could get some feedback on: bash ...
2
votes
2answers
59 views

Querying multiple tables to pull data to show to the user

I have a function that I use to display a relatively large amount of data to the user: ...
4
votes
2answers
80 views

Find minutes with no data in database

I'm trying to show a table, for each ID, to see if there is data available. In this case, its measurements. If there's no data, that means the logger isn't doing its job properly. I currently have ...
6
votes
1answer
93 views

Entering information about a business and finding matches

I'm writing a Java Servlet application where the users must enter information about a business. I'd like to prevent as many duplicate entries in the MySQL database as possible and I'd appreciate ...
3
votes
1answer
79 views

Enhance CSV file database import

I'm using the script below to import a large .csv file to my database. If the table is empty the process takes about 5 minutes to finish on a local machine. If I'm using the file to update existing ...
0
votes
2answers
45 views

Django ListView with MySQL query for the queryset

(Note: Even if you don't know Django, it's probably the query that needs work anyway, so you probably don't need to know Django/Python) I have a ListView that ...
5
votes
1answer
109 views

Function to run MySQL SELECT queries with no leaks

I am upgrading an old massive website that is a Classic ASP \ ASP.NET hybrid. I still have a long way to MVC. Right now I want to convert all code that uses ODBC to the mysql connector specific code. ...
3
votes
2answers
75 views

Auction function for a game

This is an auction function for a game where you can bid on houses on the website. You set a limit, and if posts limit below current bet or below your limit, it will raise the bid from current plus ...
3
votes
1answer
45 views

MySQL case statement with two tables

How can I improve the following working SQL statement for better performance and consistency? ...
5
votes
2answers
40 views

Out of one Oracle into another

A project that I have been working on required data to be transferred from an Oracle database into MySQL. The process I devised for that transfer involved a query (included below) on the Oracle ...
3
votes
2answers
73 views

Select products and config values from MySQL

I have working code that gets products details and config values from MySQL bit it's combined with HTML, I would like to know a better way to do this, maybe a class that I can use. ...
4
votes
1answer
28 views

Grouping counts from tables by account ID

I'm working with this query to get counts from three different tables, and to group the results by account ID: ...
3
votes
6answers
626 views

OOP PDO Database Connection

I'm currently learning about PDO, and trying to connect to the database and CRUD in OOP way, this is a simple code that I use. index.php ...
3
votes
2answers
72 views

Can I further secure this blog post loading script?

The following code is developed around a mysql database where the posts table has 3 columns: post_ID, date and title. config.php holds the values for $dsn, ...
6
votes
5answers
303 views

Is there a more efficient way of executing multiple SQL prepared statements at once?

I'm updating more than one table at once and, as you will see, it uses a lot of similar looking code. Is there a more efficient way of doing this, perhaps some way of combining the queries? For ...
3
votes
1answer
192 views

MySQL Java in JTable

This is an assignment posted here. (Part-B) The aim here is to create a GUI in which the user can search for and insert data into a particular table of a MySQL database. Is this an appropriate ...
3
votes
1answer
96 views

Simulating Natural Sorting in MySQL with PHP

I have a MySQL table which contains product SKUs among other things. PHP powers importing data into this database, managing data through a control panel, displaying the information on the front-end, ...
2
votes
2answers
142 views

Using database connection and GUI

In my project there are a lot of GUI so I have a class for each GUI. I created a class to connect to my db (MySQL). Remember, I don't have problems with code not working. The code (important to this ...
3
votes
1answer
116 views

Security flaws in smartphone application

And could you give me any security and optimization recommendations? ...
0
votes
1answer
54 views

Correct MySQL DB Query and processing

I ve got a table called EXP it looks like this The table contains REG_ID - (id of the registred users) TRA_TYPE - (type of transportation the user chose 1-export 2-import) PRO_ID - (product id ...
3
votes
3answers
102 views

PDO insert from check boxes

I've seen so many different ways of doing this all seem very complex and all seem to be done in MySQL. I'm using PDO in my project so I've had a go myself to see what I could come up with. Is this ...
4
votes
1answer
93 views

High school social network query for friends in common

This is sourced from the Stanford Coursera self study DB class SQL quizzes: Students at your hometown high school have decided to organize their social network using databases. So far, they have ...
7
votes
3answers
464 views

Comments in PHP authentication system

Leaving aside absolutely everything about the code itself (but if you find stuff that's not ok feel free to comment on them). What I'm asking here is the following: Is my code properly commented? ...
2
votes
0answers
50 views

Merging totals from rows with duplicate IDs

I have the following query which updates the quantity when there are duplicate items and users (there should only ever be 2 duplicates), then deletes the row which doesn't get updated... ...
2
votes
0answers
41 views

MySQL natural search and like search

I have written two queries for searching, but I want to simplify them as it seems needed. ...
1
vote
2answers
2k views

Best way to insert multiple rows in MySQL

I am building a store. When a user decides to make a purchase I need to store it in the database ( you don't say? Duh! ) but since the purchase might be of more than 1 item I'm wondering which way is ...
6
votes
3answers
2k views

Foreach within Foreach loop - is this code poor form?

I am using the following code poor form. I am interested in how I can optimise this and use the correct methods. I understand the DRY concept and will look to employ that throughout my code. However, ...
3
votes
1answer
103 views

Managing “Jobs” data in a Database

I've been working in a small page with some easy CRUD. The data I get from the database is getting shown on the page. But the way how i show the data feels a bit off. I guess it can be done in a much ...
2
votes
1answer
34 views

Query of attributes of mobile phone models, using several UNIONs to find distinct values

I'd like to know if there's any room to improve the following query which is to find distinct values from multiple tables when someone searches for a model name. Two of the tables are storing phones' ...
1
vote
1answer
70 views

Obtaining weather station data from a MySQL database

I have a PHP page for a weather station that I'm trying to build. I run multiple queries to pull out data from a MySQL database for min/max/average values for temp, pressure, humidity etc. All of ...