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

4
votes
5answers
15 views

Insert values into two different but similar tables

I have a combobox with two items. And if one is selected I want to write data to "salary" table and if selected another, to "other" table. The difference between two code blocks is only one word. I ...
1
vote
0answers
14 views

auto_increment composite primary key with MySQL InnoDB

The intent is to have an auto_increment composite primary key on a InnoDB table which mimics the behavior as on a MyISAM table. The following assumes (3) InnoDB tables all with an auto_increment ...
3
votes
2answers
61 views

Checking a user's emails using an ID

I'm trying to do this: Getting user's ID based on his email name. Using that user_id to check all his emails that have been sent for him so far. ...
1
vote
1answer
56 views

Speed improvements for MySQL update

As I've mentioned in previous questions, I am writing MySQL statements to update overlapping database entries and insert new data into various tables. My database design looks something like this, ...
-1
votes
0answers
12 views

PHP mysqli always returning mysqli::bind_param() error [on hold]

I'm trying to save some data from my webpage to MYSQL database, but it returning a Call to a member function bind_param() on a non-object error every time. I tried ...
1
vote
0answers
23 views

Export database values as csv with a helper class

Should I be using getter and setter functions in my class nodeStruct? I am currently using them where there is need to manipulate the input value (e.g for ...
1
vote
0answers
30 views

Printing many-to-many relationships in an HTML/bootstrap table

I need to print the many-to-many relation ship in my tablet. However, I don't know what to do for my case: I tried tons of ideas, however, I may have done something wrong because nothing worked. Here ...
1
vote
1answer
25 views

Database connection in MVC model

I followed the tutorial Build a PHP MVC Application and have implemented a database connection. I made a seperate database connection class and I call it in the controller. It works, but now I have ...
2
votes
1answer
42 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
40 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
66 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
57 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
43 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
55 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
1answer
83 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
54 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
90 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
23 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. ...
4
votes
1answer
89 views

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
77 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
102 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
71 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: ...
1
vote
1answer
66 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
24 views

Get all members from country depending on multiple tables

I have 4 tables, filled with some example data user table ...
0
votes
0answers
29 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
28 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
56 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
46 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
208 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
52 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
37 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
304 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
126 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
104 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. ...
3
votes
1answer
83 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 ...
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
35 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
67 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. ...