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

learn more… | top users | synonyms

0
votes
0answers
9 views

Relational modeled design [migrated]

The scenario (I believe this question has quite a limited scope and assume with complete normalization a "best" design can be concluded regardless of differing opinions) I have images in a database ...
3
votes
0answers
21 views

sql indexing and performance [migrated]

I am using mysql5.1, i have table which has about 15 lakh (1.5 million) records.This table has records for different entities i.e child records for all master entities. There are 8 columns in this ...
2
votes
2answers
41 views

Inline PHP IP access log

For a website, I've got some inline PHP, posted below. It's supposed to log traffic to the website, and it does its job fine. But at the end of the day, I'm not even close to a PHP developer, and ...
3
votes
2answers
67 views

Is there a “prettier” way of forming this query, or a more efficient way of joining the tables?

Yesterday I posted a question involving multiple nested queries. The queries pulled information from the database and created a directory listing of all employees. There are two many-to-many ...
0
votes
1answer
43 views

Would multiple joins boost performance, or are the nested queries an acceptable way to handle the situation?

I'm working on a directory that lists employee information. Each employee can belong to multiple departments and each employee can have multiple job titles. I have 5 ...
7
votes
1answer
53 views

A faster way to combine two SQL table

I would like to give it a try and ask about my codes on here from now on to see if there are improvement for'em this code is supposed to combine two sql tables into one. ...
5
votes
1answer
30 views

Separating Duplicates from Uniques

I have a MySQL table with a very large data. What I need is to find and separate duplicates from the unique rows Let's say this is my table: ...
7
votes
4answers
490 views

Bad practices in this procedure to calculate player statistics?

I recently self-taught myself MySQL as quickly as possible because it was needed for a project that I'm working on. Now that I've got some time I've been working on improving some thrown together SQL ...
2
votes
1answer
132 views

How to prevent SQL injection PHP and MySQL?

I have been reading about SQL injection and I want to secure my code. I am not asking anyone to write me a code, but I just want to learn it in simple terms. The best way for me to learn is to edit ...
4
votes
1answer
79 views

Ruby script to load xlsx files into mysql db

I put together this Ruby script (1.9.3) to load data into MySQL from many xlsx files that contain data entered by people. These files typically have many illegal characters and it has been difficult ...
4
votes
1answer
58 views

Am I organising my PHP code effectively?

I'm very new to learning PHP & MySQL (I've got past experience with Java) and I'm doubting whether my code is organised well. I've got an index page which has two forms; the first is a form to ...
3
votes
1answer
46 views

MySql Connection Pool

I have a multi-threaded app (WCF) that writes to a MySql db. I want to use MySql's built in connection pooling abilities. As far as I can tell, to do that, I should set ...
9
votes
2answers
128 views

Want to check if I am using PDO correctly

So today after few years of not programming in PHP I decided to go back, but to do so I needed to change all MySQL connections. So I want to check if I am using it good. Earlier I used to write ...
5
votes
2answers
48 views

SQL Query that pulls rows in current table based on parent id optimization

I am creating a user permission system. I will have my user permissions set up off of "objects" and not pages. For example, I have an EVENTS section. Within that ...
4
votes
1answer
108 views

PDO prepared statement - binding variable number of values

Please let me know if I have over/under explained my question :) HTML table row - the numerals from each id attribute, in this example "408" and "409", are the database tables primary ID numbers, one ...
1
vote
1answer
42 views

Replacement of MySQL Query [closed]

I want to replace an old MySQL statement with new one. Does anyone know me if the following replacement concept is correct? The statement ...
3
votes
1answer
53 views

My node app with valid syntax is failing silently, but not breaking. Infrastructure problem?

I built a simple Node app, and the code "works", with no failures, no syntax errors, and does not break, but one component doesn't work right. I showed a snippet on Stack Overflow, in this question, ...
4
votes
1answer
103 views

How is OOP achieved with configuration files in PHP?

Someone asked if their singleton is good for OOP: Using a singleton class to get and set program wide settings. However, the answer just provides tweaks to his existing code - but the question ...
3
votes
1answer
80 views

How to go from Spaghetti PHP OOP to SOLID OOP?

I am beyond stuck in a half way point between PHP structural and OOP, but I can never achieve proper SOLID patterns despite reading DI, IOC, and reading about the interfaces. Rather than to read ...
6
votes
1answer
52 views

Removing image records if no physical file exists

I have a working script that selects image fields in all tables and empty their values if the physical file doesnt exist. ...
2
votes
2answers
119 views

Login code probably not secure

I'm new to PHP security and have made this login file: ...
6
votes
2answers
638 views

PHP login system - is it secure?

I have created a PHP login system based off of this site. My main concern is: Is it secure? I chose that because to me it looked secure, but a 2nd or 3rd opinion never hurts. The idea of the project ...
1
vote
1answer
48 views

Better way to load Mysql query in PHP Array

Here is my code: ...
5
votes
1answer
83 views

Query performance of a SELECT statement using WHERE and NOT IN

Can anyone help improve the performance of my query? When I run it, it locks the database for 5 to 10 minutes. ...
1
vote
1answer
27 views

Like system with MySQL on multiple types of pages [closed]

I want to have a like system on my website on multiple pages like "news", "comments", "forum posts" etc. So I was wondering what was the best way to do it between: having like tables for each of my ...
1
vote
1answer
36 views

Performance problem: Ranking with ties and skipping rows on passmark condition

I am using the following code for calculating ranking and it is working great for not large data. But when it comes to large data, processing time takes almost a minute. Please can anyone suggest a ...
2
votes
1answer
74 views

Rendering a history list of shows with different options

I have some PHP code I'm working on which contains 2 queries and I need to set extra conditions for 2 out of 3 view options and one less query for 1 out of 3 view options. Basically, I'm rendering a ...
1
vote
1answer
77 views

How to turn 201 queries into 1? [closed]

I have a PHP web app that manages contacts. It has four main functions that display: contacts with upcoming birthdays; the 20 most viewed contacts; all contacts (200 limit) plus their phone number ...
3
votes
2answers
129 views

PDO MySQL spaghetti coding

I'm new to this PDO PHP and I have coded this spaghetti style. I hope you can give me idea how to improve using prepared statements. I'm not a lazy person, but I really need your help to improve my ...
2
votes
1answer
118 views

Listing with JSON or plain HTML

I have a website which has reviews about games. Right now, to list the advantages (+) and disadvantages (-) of that game, there's a textarea in the admin panel with a WYSIWYG editor with only ...
2
votes
1answer
130 views

How can I improve this PHP MySQL rank query?

In my db MySQL, I have a table ranks with many fields, one for each page I want limit access for the user in the menu application with PHP control: ...
5
votes
1answer
97 views

Best Practices concerning Includes and SQL Connect Strings

I'm just starting to learn PHP. I have three random questions about PHP and one question about Code Review. None of them are technical questions ("will this work?"); they're best practices questions ...
6
votes
2answers
176 views
5
votes
1answer
91 views

System for inputting and monitoring worker shifts

I've been building a system for inputting and monitoring shifts for casual staff, who work across multiple sites with the ability to generate accounting information. I've had some help from Stack ...
2
votes
1answer
134 views

Optimize MySQL in a stored procedure

How should I optimize my code for better performance? When I execute the code outside of MySQL stored proc it is 500% faster. MySQL stored procedure ...
3
votes
1answer
79 views

Query optimization PHP for string concatination

I have an entity RegistrationForm which has a OneToMany-relationship with SurveyAnswer. An answer can either have a ...
7
votes
1answer
80 views

MySQL in Vb to update every field of every page of a form in the database

I have a VB code here that connects to a MySQL database to update every control on every page of a form in our database. I am told is taking longer than it should to run. Comment 'Setup MySql ...
3
votes
1answer
61 views

Searching for news articles in database

The first thing I would like to say is that I do have a fully functioning script, but the script is ugly, and I am wondering if there is a way to optimize it. The script looks to see if I have at ...
2
votes
1answer
67 views

Update SQL query using UNIX time

I would like to test the following garbage collector code on a database of sessions. It should be following the conditions below: if 'remember me' is enabled by the user, then it should delete all ...
5
votes
3answers
203 views

Is my MySQL library wrapper neat? How can I do better?

I'm moderately new to programming in C and I'm not sure about programming practices with code; suddenly I have had fears that my code is messy and disorganized. I can read it when I come back a month ...
3
votes
2answers
92 views

Is code optimization for branch predictor necessary now?

I would like to share a part of some code written several years ago (I have changed from mysql to mysqli); this code works perfectly. I am new to my company, and our senior programmers wrote some ...
5
votes
1answer
121 views

Python Connection with MySQL

I want to share something with this community. I did a class connection between Python and MySQL. I hope you can help me with this project and help me do a better class. Here is the class ...
1
vote
1answer
203 views

Checking a mysql connection and refreshing it

I am using the following function to check if a mysql connection is in an invalid state or if it has reached a predefined maximum operation count: ...
4
votes
1answer
215 views

Optimize MySQL double select inside for-loop

I want to get the number if items with state 4 and 1 from my database for each day between a certain date. Is there a smarter ...
6
votes
2answers
221 views

My API Keygen: Is it secure?

Below is an api key gen script for a cryptocurrency trading platform i am building. first it checks to see if a key exists in the db for the user id. if it does exist it displays the key. if it ...
2
votes
1answer
783 views

PDO Login/Register system review

I wrote my very first login/register PDO system today. I know there is still a lot of flaws, but I was wondering what tips and advice you have to help me improve this. I know that PDO is much more ...
0
votes
2answers
431 views

Dumping a MySQL database to a file using a PHP script

I know there are countless questions on SO, and several articles on the web regarding this subject, but after looking at all the options, I was moved to write my own code to address my own ...
7
votes
2answers
101 views

Servlet for querying database on some high-loaded system

What should the code do: Process client HTML requests, query database and return the answer in XML. Working with a high load. I need to know how can it be optimized. Is something terribly wrong with ...
4
votes
1answer
75 views

Need help optimizing PHP/MySQL code snippet

I am sorry for the simple request, but I'm trying to figure out the best way to optimizing the following bit of code. I hate using 20 lines of code when 12-15 will suffice. I also don't like having ...
4
votes
1answer
95 views

Make this MySQL query more elegant &/or efficient

I have created a MySQL query that works, but I feel there must be a better way. The query will be used by a PHP script whose purpose is to assign conditions & subconditions to new participants in ...