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
51
votes
2answers
58k 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 (...
38
votes
5answers
9k views

Database connection in constructor and destructor

I am playing with different ways to do database interaction in PHP, and one of the ideas I have been playing with is connecting to the DB in the constructor and disconnecting in the destructor. This ...
27
votes
3answers
35k views

CodeIgniter Active Record Subqueries

I use CodeIgniter at work, and one of our model files had a lot of subqueries in it. I originally had to manually write each subquery, and wondered if I could use active records instead. So, to make ...
24
votes
3answers
2k views

Complex query to count votes with a redistribution system

I've spent the last couple of evenings trying to build a system for redistribution of votes in a ranked voting system. I've finally come up with the model for redistributing surpluses from a candidate ...
18
votes
2answers
581 views

A take on DB Abstraction - PHP / MySql

It's a little bit more code but i wanted to show the full class. I highlight the points i'd like input after the source. I've cut comments since they where not in english and translated the important ...
15
votes
8answers
4k views

Asking a user to take money from a checking account and move it to a savings account

I'm aiming to get this program right as I might show it at a job interview. The code below runs fine but I would like to know if there's anything that can be improved in terms of readability, good ...
15
votes
3answers
392 views

Search script code efficiency

Is there a more efficient way to write this? This script will be used heavily and I want to make sure I do not have any memory leaks or speed issues. This script gets an input from a form and ...
15
votes
3answers
237 views

Database schema for holding game save files

I have a database schema for a game to hold save files where some tables have a one-to-one relationship to classes. I was wondering if I should split up some tables. Example: ...
15
votes
2answers
2k views

PHP URL Shortener

I just developed a URL shortener. index.php: ...
14
votes
2answers
7k 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 ...
14
votes
2answers
119 views

Revision 1 - Step 1: PsychoProductions management tool project

I started a project to build my own invoicing and management system to take the place of prohibitively expensive QuickBooks software. This will be broken down in 5 steps, with the current step in bold ...
14
votes
1answer
956 views

Web application for a restaurant

I'm making a web application for a restaurant kind of type. The idea is to administrate the orders and customers. For selecting one of the orders and showing more specific data about it, I have this ...
13
votes
3answers
7k views

Basic user registration code

My first attempt at a user registration code. Login.php defines database log in variables (e.g. Database name, Table name, etc) ...
13
votes
1answer
875 views

Abusing Excel VBA… to maintain data stored in a database

I need to build a little UI to allow easy maintenance of some data stored in a MySQL database, and the end user wants to do that in Excel (I know, I know). The code I came up with comes pretty close ...
13
votes
1answer
126 views

ThorsSQL Lib: Part 3: Layer 1

Have a working version of MySQL implementation of ThorsSQL library done. If you want to check it out you can find the whole thing on github ThorsSQL. This is a follow on to previous code Reviews: ...
12
votes
6answers
3k views

Efficiency with strcpy, strcat and malloc

I'm still learning C, but I'm trying to make sure I've got a decent grasp on working with "strings" and data structures. If possible, I'd like a little input on how I'm handling this and see if it ...
12
votes
3answers
3k views

Creating connections and executing queries/updates

I've recently learned how to use MySQL to store/retrieve data. I've created a MySQLManager class for creating connections and executing queries/updates. Would this ...
11
votes
3answers
782 views

Acquiring user information about students and classes

I have a Java application that uses a few switch statements to get user information about students and classes. I have three MySQL tables: students student_id | student_name | hometown ...
11
votes
3answers
671 views

Secured registration script

I created code for my registration form on my social network. I want to know if it is secured enough to release on the web as a public social network. Also, all of the code works. I just want to make ...
11
votes
3answers
237 views

Geographic search

I have this table (inradar_ad) with almost 300k entries. I want to know why my query takes 160 secs to run. I tried limiting with ...
11
votes
2answers
2k views

Updating user information [closed]

When I realized that the code below has a major problem in what it'll do (it'll just update the database with information currently in the database), I was told that there are a lot of mistakes. ...
11
votes
1answer
90 views

MySQL homeowner database

This database must be able to track multiple home owners, who may own many properties, have many phone numbers, and their mailing address may depend on what month we're in. Each property may have more ...
11
votes
1answer
79 views

Python RPI button board

My project consists of a Raspberry Pi 2B V1.1 connected to a number of push-buttons via GPIO pins. The goal is to create a panel of buttons, allowing the user to make a selection of one or more items ...
10
votes
2answers
791 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 ...
10
votes
1answer
218 views

Science Fiction Wall of Fame (Shame?)

I have a few of hobbies, one is reading science fiction and fantasy and another is coding solutions. I thought I might have a chance to combine both hobbies on this project. I have well over 1500 ...
10
votes
1answer
94 views

Automating a WordPress install

I do not have a whole lot to do over winter break, so I wrote this little script to automate a Wordpress install (currently can only install once instance) on a fresh Debian server (tested, working ...
9
votes
4answers
1k views

Inserting 1 line into my SQL database

This is for adding code into my table really easily, however it will be called 2000+ times per second, so I need to know if this is the most efficient code to add a row to the database. ...
9
votes
2answers
4k views

MySQL class to add user/database

I'm creating tool to add new virtualhost on UNIX-box. One of tasks is to add a new user and database to MariaDB (aka MySQL) server. In fact - this my first 'real' attempt to use OOP. Here is class, ...
9
votes
1answer
2k views

Login system based off of another site

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 ...
9
votes
1answer
74 views

Step 1: PsychoProductions management tool project

I started a project to build my own invoicing and management system to take the place of prohibitively expensive QuickBooks software. This will be broken down in 5 steps, with the current step in bold ...
9
votes
1answer
197 views

Creating a Perl webserver

Intro Finally had the time to do some wargames again, but I have come to the point where I need to build my own test enviroment to test certain ideas, because I can't test it online. The current ...
8
votes
6answers
23k 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 ...
8
votes
4answers
574 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 ...
8
votes
3answers
622 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? ...
8
votes
4answers
948 views

Checking 160,000 records in a database for changes

I am checking over 160,000 records in my database every 24 hours to see if there were changes in the incoming data coming from API and my existing data in the database. If there were I am updating ...
8
votes
3answers
10k views

Java and MySQL connection classes and method implementations

I got three classes for MySQL Database access/manipulation: Conector. It has got methods for connecting, disconnecting, querying and updating db. ...
8
votes
2answers
131 views

Non-Entity framework database interaction model

A C# WPF user interface has been developed for the Book Inventory MySQL database previously shown in this question. Since the database had already been developed this was a database first ...
8
votes
5answers
2k views

Database abstraction in Java

I am working on a project in Java which includes a lot of database related tasks. For instance, I would have to insert, update, retrieve data so many times within the application. To use code ...
8
votes
4answers
30k 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 ...
8
votes
1answer
40k views

Simple login system using Python Flask and MySQL

I've made a login page using Python Flask which works with MySQL. I started learning Flask 2 days ago and it was fun, so I came up with this: ...
8
votes
5answers
12k views

Database class using PDO

The point of this question I'm actually using it while developing a simple application and it seems to cover all my needs. Also it uses PDO so that we don't really have to worry about SQL Injection. ...
8
votes
2answers
271 views

Local user registration

More javascript (nodejs) to go with the passport wrapper I just posted: UserBook.js ...
8
votes
1answer
148 views

A PHP API which has an endpoint for processing a user's facebook login details

I'm working on a PHP API for my angular JS Phonegap application. At the moment I'm focusing on working with a user's facebook public profile data. I'll explain the process a little first: The user ...
8
votes
2answers
688 views

Object Paradigm for PHP, Practice in Design

I've created and I manage a point of sale web application built in PHP which has thus far followed no clear guidelines or methodology for development; it's operation is completely procedural. In turn, ...
8
votes
2answers
1k views

Comparing data in 2 tables on different servers with CHECKSUM

So I've had a problem where I need to compare data in 2 different tables on two different servers. Now, I know MySQL supports CHECKSUM TABLES, but from my testing ...
8
votes
1answer
810 views

OR vs UNION in message tables

I have a dilemma. I have a messages table containing fields id, sender, receiver, body I need to select all users a given user has had a conversation with. A ...
8
votes
2answers
5k views

Connecting to a database

I'm working on a web application that I inherited from a colleague long gone. To connect to the MySQL database I use the following classes: statement.php ...
8
votes
1answer
433 views

Database method to query

I have a database class that in __construct() initialize a PDO connection and insert the instance into a $db private var. Now i'm working on a method that can be ...
8
votes
2answers
19k views

Strategy to create audit trails for a SQL database

I wish to create audit trails for specific tables and columns in my database, and document who made the change, when it was made, and what the change was. To do so, I will create the following tables:...
8
votes
1answer
196 views

SELECTing percentage and count of votes

I have the following tables structures: ...