MySQL is an open-source, relational database management system. If your PHP code uses MySQLi, use the MySQLi tag instead.

learn more… | top users | synonyms

2
votes
2answers
31 views

Get all members from each group

I have a table of groups, and a table of members. Each member belongs to one group. This is how it looks (more groups then 2 are possible): Groups ...
3
votes
1answer
37 views

Python program that takes input and runs queries on a mySQL database on it

I've been slowly learning Python so I want to know what the most Python-esque way of doing things are. The scenario is that I'm connected to a database with a Customer and a SalesRep table in a ...
1
vote
3answers
61 views

Selecting a table with multiple ID on MySQL using PHP PDO

I have made a MySQL script to query a table with a set of id using an IN clause and after some reading I found out that there are security issues with it like prone ...
6
votes
3answers
51 views

Running a MySQL query with an admin class

This is my admin class, DB class and how I use OOP. I am looking for ways to improve my code to make better use of OOP. Please help me if you think I can improve my code in some way. db.class.php <...
1
vote
2answers
40 views

Method to get user information (OOP / MVC approach)

I coded a small user script with PHP. I'm improving the script, learning from my mistakes. I recently learned about object oriented programming and wrote 2 big god classes (user class and message ...
0
votes
2answers
54 views

PHP MySQL connection class

I'm trying to build a class that connects to the database. It does the job but it is not very elegant. I also have no understanding of singleton class or dependency injection. Is this safe? Can you ...
-3
votes
0answers
28 views

PHP mysql incorrect code? [closed]

I have this script ...
3
votes
1answer
80 views

More efficient method to check for duplicate database entries?

I am saving company information in a database, and if repeat information is found, I want to update the overlapping rows. Some of the supported fields are emails, phone numbers, organization names, ...
2
votes
2answers
50 views

Level system in a gamification platform

Currently, I'm working on gamification platform and I have the following rules for achieving a new level: Level 0: When user registers Level 1: When user confirms account Level 2: When user ...
2
votes
0answers
21 views

Search Indexer Transaction Safety

I am writing a search indexer for a site I built. It counts the number of times a word is used in a given story allowing one use of the word per chapter. I have also attempt to weight words in the ...
-3
votes
0answers
30 views

Query to work out amounts

How can this query be improved? ...
4
votes
2answers
88 views

Social network queries for profiles, posts, and followers

The code below is for a social networking system. The problem is that when there are many posts and many followers, the performance is slow. Is something wrong with the queries and the script below? ...
1
vote
0answers
27 views

Returning direct status changes of user statuses

I have a query which returns direct status changes (no intermediary changes) of user statuses: ...
1
vote
0answers
22 views

Database table for WordPress plugin

Is there a better solution to create a database table for a WordPress Plugin? How can I simplify this query? What code improvements could be made in this code? Any ideas would be great. ...
-1
votes
0answers
31 views

How to add some items to an array based on a condition?

I have these two queries: ...
4
votes
1answer
57 views
+100

Migrate files from MySQL BLOBs to PostgreSQL largeobjects

As title says, this piece of code migrates files (binary and metadata) from a database to another one with different structure. Currently my problem is that when I have to deal with a big database (...
3
votes
1answer
75 views

Storing MySQL data in Memcache

I have written a script that checks if data is known in memcached, and if not it queries it from the mysql db and stores it. I would appreciate any inputs if i have done this the "correct" way, since ...
6
votes
1answer
99 views

TCP authentication server and client

This is the first time I'm dealing with C# as I'm accustomed to Java sockets, so I do want your full review and anything you think I can accomplish better or optimize in the code will be very ...
1
vote
5answers
66 views

A like/unlike system using MySQL and PDO

I have created a Like/Unlike system. The user clicks one to indicate a "like", and clicks again to "unlike" it. Currently I do that like this: ...
0
votes
0answers
8 views

How to create a like/unlike system? [duplicate]

I'm trying to create a Like/Unlike system. Currently I do that like this: ...
1
vote
1answer
65 views

PHP store data from form into MySql DB

This is the first time I've tried this. I'd like some feedback on how I did, including any bad practice warnings. For example is it a really bad idea to allow the code to recreate the table if it ...
1
vote
1answer
23 views

Get all members from country depending on multiple tables

I have 4 tables, filled with some example data user table ...
0
votes
0answers
28 views

MySQL stored procedure to search medical insurance claims

This stored procedure is taking a lot of time to execute. How can I optimize this query? ...
1
vote
0answers
26 views

Scrape google apps page and store application details in database

Below is a python script which scrapes specific google apps url for example https://play.google.com/store/apps/details?id=com.mojang.minecraftpe and save the ...
6
votes
2answers
51 views

Database design for a transportation company

I am designing a database and I am just wondering if I am doing it correctly. I have tables for things like State with all the states in them and then I reference the ID in other tables. But should I ...
2
votes
2answers
33 views

Insert into two tables during user registration using PHP

I'm working on creating a user registration script in PHP. I have two tables that need to be inserted into. One that stores some general user information, and another that stores their login ...
2
votes
1answer
44 views

Sales report for an invoicing system

I am creating a sort of Sales Report for an Invoicing System. I have an extremely complex MySQL Query that takes a very long time to execute (usually about 10 - 15 seconds). It involves multiple ...
5
votes
2answers
193 views

List<dynamic> to ComboBox

This code get a list<dynamic> from a repository class using Dapper. I need to bind this list to a ...
0
votes
1answer
33 views

SQL query with GROUP BY to show badges and points by user and course

I have the following database schema. My goal is to obtain a result set that lists the total badge points earned by each user. The badges might be earned in different courses. I want to include the ...
4
votes
1answer
58 views

SQL query that flattens many-to-one relationships

I have a database with these tables, where each mapping table represents a "many-to-one" relationship between the table on the right and the table on the left (click to enlarge): I am selecting a ...
3
votes
0answers
51 views

Fantasy league tracker for Game of Thrones

So I've just started learning about MySQL and PHP to create a fantasy league tracker for Game of Thrones for my office. I got it to technically work fine, but I think it's way clunkier than it has to ...
3
votes
1answer
44 views

Transfer XML data to database where table fields must match with elements

This is my first Java program, where I have a class that gets XML data from a certain website and another class that does all the database related tricks. I omitted all non-related code to this case. ...
1
vote
1answer
36 views

Simple bcrypt Register User and User Login using PHP - is this approach acceptable?

I am learning PHP and have been looking into a suitable way to safely store password data in MySQL. Following advice from here (http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-...
3
votes
2answers
292 views

Selecting all movies where specified actors worked together

Here's a query I wrote trying to find all movies that three actors have been in together: ...
1
vote
0answers
19 views

Send Google Cloud Messages

I wrote code which is doing query and insert inside while loop. ...
0
votes
3answers
110 views

Datagridview filter with BindingSource

I want to perform a filter on a DataGridView using 3 different TextBox. The solution below works, but does not consider very ...
0
votes
0answers
13 views

Select Server Settings from one table if the status reads 'issued' in another (mySQL stored procedure)

I'm just wondering if this is OK to do. If I don't have the else statement I get an SQLException because the query doesn't return a result. Is there a better way? <...
4
votes
2answers
96 views

Using PHP PDO to fetch employee details

I am finally making the move to object oriented PHP. This has been something I have been quite reluctant to do, but I now feel that it could benefit me, and bring me up-to-date with current practices. ...
1
vote
0answers
64 views

Efficient MySQL PDO Class

I tried to create a secure and efficient PDO class.I would really appreciate your feedback to make it more production ready.Github Link ...
2
votes
0answers
38 views

Retrieving the most recent posts from the users someone is following

I have two different implementations for retrieving posts from the users someone is following and I want to know which one you would recommend using. First I'll show you the tables, and then the two ...
1
vote
0answers
13 views

Table Trigger to update date columns

I've created the following trigger to force two columns (date_edited and date_deleted) to have the ...
1
vote
1answer
32 views

Bulk customer creation

Here is my script which takes 50k records from a CSV and does CRUD operation with them. Unfortunately there are a lot of issues with the performance. CSV fields are: msisdn, resellerid, product ...
3
votes
0answers
34 views

Selecting the most recent record for each product

I have the following structure of a table: ...
1
vote
3answers
53 views

User-tracking history query

I have a query consisting of UNIONs. ...
3
votes
1answer
65 views

Is this query vulnerable? ( MySQL Injections )

Already many days I'm documenting about the SQL Injection. I was wondering if the code I wrote is vulnerable in some of its parts. ...
4
votes
1answer
123 views

PHP secure login script

I was just wondering how secure my code looked and if I'm overlooking any serious mistakes. Any suggestions/critiques are welcome. This is my relevant login script. login.php ...
2
votes
2answers
76 views
0
votes
2answers
50 views
2
votes
1answer
52 views

Generating a MySQL query

I'm trying to create a function to return a DataTable with the results of a MySQL query where the program doesn't know the names of the queried columns until run-time. How can I improve the ...
3
votes
1answer
40 views

Splitting apart a comma separated list

I have a system that outputs a comma separated string into a single column. I need to grab the individual values out of that list. The list could have random spaces and commas that need to be ...