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

-1
votes
0answers
13 views

CRUD class for database

I have a database class that connects to a Database and runs CRUD operations. I need a critique of how well this class adheres to SOLID principles.A class to run all database operations seems like '...
-1
votes
0answers
14 views

BCrypt.Net Login [on hold]

I'm trying to log into the mySQL database using the program I've created. Accounts are created on the website, using PASSWORD_DEFAULT which is blowfish. However, I can't seem to be able to correctly ...
0
votes
0answers
32 views

MySQL query with multiple union and group by

My database schema is something like this: desc SUB: ...
-3
votes
0answers
20 views

Code works for smaller number of text files but not for folder containing huge number of text files [on hold]

The following code runs properly for small number of text files. When it is executed for huge number of text files (500-600 number of text files) it works properly upto print("#samples: %d, #...
0
votes
0answers
6 views

php driven web form to mysql db code not running [closed]

Would love any pointers, new to sql... ...
1
vote
2answers
52 views

Fetching items from database with “Outstanding” status

I am fetching around more than 300000 items through a query: ...
1
vote
1answer
43 views

Laravel generate category list from product results

I have product results with some filter, and the one is category. I'll get the category list from product results. the model category and products is one to many relationship. This is the search ...
7
votes
2answers
79 views

Multiple SELECT with LEFT JOIN to order results

I have two tables, looking like this: Table 1 ...
-4
votes
1answer
42 views

How i can do this in one query [closed]

How i can do this in one query ...
1
vote
1answer
26 views

Extracting site visit information from a REST API call, including addresses from a MySQL database

I'm building a web app that pulls data from a ticketing system via REST API. I'm currently able to pull all of the data I need just fine but the loading process is really slow. I'd love any feedback ...
1
vote
1answer
30 views

Getting the last post of all threads

My MySQL query is loading very slowly (over 30 secs) and I was wandering what tweaks I can make to optimize it. The query should return the last post with the string "?" of all threads. ...
0
votes
1answer
27 views

Is the format of this PDO mysql statement correct

I have been writing simple php programs, trying to adhere to the PSR standards, for writing code. However they do not seem to have any standards for writing mysql PDO statements in. For example I ...
2
votes
1answer
31 views

Eliminate redundancy from session authentication

I have a session authentication script and it works, but I can't find a way to eliminate the redundancy where the two database queries are. One checks if the cookie has a corresponding entry, and the ...
2
votes
1answer
47 views

Get all company branches using stored procedure

Am creating an application for a transportation company that will store information about their drivers, the cars they drive and to what branches and districts they belong to. I have a branch table ...
1
vote
3answers
59 views

Three PHP database queries to manage accounts

I have a database connection PHP file which has a lot of queries to the database. Here are 3 of the functions that I am using: ...
1
vote
0answers
19 views

Api with security through a private and public key

I want to make users login into an app, the code on my server serves a "token". This is based on a salt that is saved for each user, the login date, expDate and the userId. That value is hashed by the ...
2
votes
0answers
58 views

Database Query Optimization

I made a website where is possible to search for the best transportation from a place to another. For instance, i need to go from Berlin to Bremen? the website will search in its internal database for ...
4
votes
6answers
62 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
18 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
93 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
71 views

MySQL statements to update overlapping database entries and insert new data into various tables

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
vote
0answers
27 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
43 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
30 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
44 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
46 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
70 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
62 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
47 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 ...
2
votes
2answers
83 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
85 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
62 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
22 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 ...
4
votes
2answers
95 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
24 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
84 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
131 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
85 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
67 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
26 views

Get all members from country depending on multiple tables

I have 4 tables, filled with some example data user table ...
0
votes
0answers
30 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
41 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
62 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
45 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
47 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
245 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
35 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
60 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 ...