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

learn more… | top users | synonyms

0
votes
0answers
7 views

Parse a .sql file via shell_exec returning null, suggestions? [on hold]

I've been scratching my head on this one for awhile but to no avail, shell_exec isn't a disabled function but the output is always NULL, anyone experienced this issue? Thanks in advance for any tips. ...
3
votes
1answer
18 views

Grouping counts from tables by account ID

I'm working with this query to get counts from three different tables, and to group the results by account ID: ...
3
votes
6answers
257 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 ...
3
votes
2answers
59 views

Can I further secure this blog post loading script?

The following code is developed around a mysql database where the posts table has 3 columns: post_ID, date and title. config.php holds the values for $dsn, ...
6
votes
5answers
278 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 ...
3
votes
1answer
49 views

MySQL Java in JTable

This is an assignment posted here. (Part-B) The aim here is to create a GUI in which the user can search for and insert data into a particular table of a MySQL database. Is this an appropriate ...
-2
votes
0answers
12 views

I am recieving 'user_max_connections' often and it says this code is the problem, I am not knowledgeable enough to know why? [closed]

I have been receiving lots of 'user_max_connections' errors because of this code. Please help. I do not understand why really. I am hosting with iPage and only have about 100 active users or less on ...
0
votes
0answers
22 views

display subcategories of selected category in tabular form [closed]

I have a form that has two parameters amenities and attributes. The amenities parameter has a dropdown menu that whose value gets populated from a separate table. The second parameter is attribute ...
0
votes
0answers
20 views

better practice for Ajax long polling [closed]

I'm using PHP,Mysql and Jquery for my project which has an instant notification area.I'm using ajax long polling technique and this is the first time I'm using it. my jquery function is like this ...
0
votes
0answers
5 views

Normalized Database Diagram [migrated]

So I am working on my DB design skills, and have tried to create a normalized MySQL database. Here is the diagram: The reason I added the Address table is to break the address fields into separate ...
2
votes
1answer
44 views

Simulating Natural Sorting in MySQL with PHP

I have a MySQL table which contains product SKUs among other things. PHP powers importing data into this database, managing data through a control panel, displaying the information on the front-end, ...
2
votes
2answers
102 views

Using database connection and GUI

In my project there are a lot of GUI so I have a class for each GUI. I created a class to connect to my db (MySQL). Remember, I don't have problems with code not working. The code (important to this ...
3
votes
1answer
108 views

Security flaws in smartphone application

And could you give me any security and optimization recommendations? ...
0
votes
1answer
47 views

Correct MySQL DB Query and processing

I ve got a table called EXP it looks like this The table contains REG_ID - (id of the registred users) TRA_TYPE - (type of transportation the user chose 1-export 2-import) PRO_ID - (product id ...
3
votes
3answers
83 views

PDO insert from check boxes

I've seen so many different ways of doing this all seem very complex and all seem to be done in MySQL. I'm using PDO in my project so I've had a go myself to see what I could come up with. Is this ...
4
votes
1answer
62 views

High school social network query for friends in common

This is sourced from the Stanford Coursera self study DB class SQL quizzes: Students at your hometown high school have decided to organize their social network using databases. So far, they have ...
7
votes
3answers
437 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). Before you point somewhere else, this is about code review, comments ...
2
votes
0answers
44 views

Merging totals from rows with duplicate IDs

I have the following query which updates the quantity when there are duplicate items and users (there should only ever be 2 duplicates), then deletes the row which doesn't get updated... ...
2
votes
0answers
36 views

MySQL natural search and like search

I have written two queries for searching, but I want to simplify them as it seems needed. ...
1
vote
2answers
626 views

Best way to insert multiple rows in MySQL

I am building a store. When a user decides to make a purchase I need to store it in the database ( you don't say? Duh! ) but since the purchase might be of more than 1 item I'm wondering which way is ...
5
votes
3answers
2k views

Foreach within Foreach loop - is this code poor form?

I am using the following code poor form. I am interested in how I can optimise this and use the correct methods. I understand the DRY concept and will look to employ that throughout my code. However, ...
3
votes
1answer
102 views

Managing “Jobs” data in a Database

I've been working in a small page with some easy CRUD. The data I get from the database is getting shown on the page. But the way how i show the data feels a bit off. I guess it can be done in a much ...
2
votes
1answer
33 views

Query of attributes of mobile phone models, using several UNIONs to find distinct values

I'd like to know if there's any room to improve the following query which is to find distinct values from multiple tables when someone searches for a model name. Two of the tables are storing phones' ...
1
vote
1answer
46 views

Obtaining weather station data from a MySQL database

I have a PHP page for a weather station that I'm trying to build. I run multiple queries to pull out data from a MySQL database for min/max/average values for temp, pressure, humidity etc. All of ...
1
vote
1answer
21 views

MySQL proliferation of subqueries and left joins

I have the following query: ...
1
vote
1answer
29 views

Loop through post and use in query

so i'm using a foreach loop to loop through a form i've send with javascript. In this loop I use the keys(input fields names) and values(input values) and use them to build my query, I still check for ...
1
vote
1answer
27 views

Weighting mysql full-text search results by date

I'm using innodb full-text search to return a set of results where the newest posts are more relevant. Just wanted to check that this the best method: ...
6
votes
1answer
76 views

Database of students in a social network

This is sourced from the Stanford Coursera self study DB class SQL quizzes. Students at your hometown high school have decided to organize their social network using databases. So far, they have ...
2
votes
2answers
97 views

Spreading MySQL query code over multiple lines - new lines vs concatenation

Is there any reason NOT to wrap a long query over multiple line via new lines vs using concatenation? For example, consider this: ...
3
votes
1answer
79 views

PHP MySQLi database wrapper

I am developing a mysqli database wrapper. I've made an effort to make this as fast as possible and easy to use. However, now I want to start adding callbacks (for ...
4
votes
2answers
143 views

IMDB website query to find actors by time period

I'm using data from a database from the IMDB website. The database consists of five relevant tables. Actor (id, fname, lname, gender) Movie (id, name, year, rank) Director (id, fname, lname) Cast ...
4
votes
1answer
145 views

MySQL IMDB Query Speed

I'm using data from a database from the IMDB website. The database consists of five relevant tables. Actor (id, fname, lname, gender) Movie (id, name, year, rank) Director (id, fname, lname) Cast ...
2
votes
2answers
156 views

Does this column need to be indexed?

I have the following query which brings back a list of items which fall into a particular category: ...
3
votes
3answers
197 views

SQL delivery query performance

I need a "little" help with an SQL query (MySQL). I have the following tables: COURIERS table: ...
8
votes
2answers
277 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, ...
11
votes
1answer
219 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 ...
5
votes
1answer
117 views

PDO Login/Register system I've been working on

I'm relatively new to PHP and programming as whole. I'm sure my code could be better in a lot of ways, most of which I can't fully grasp at the moment. As it stands I'm trying to avoid the general ...
4
votes
2answers
88 views

Simple login system

I'm pretty new to PHP and programming general so I'm quite sure my code is an absolute mess. My goal is to write good code, that others can understand just by looking at it. This is a simple login ...
11
votes
6answers
524 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 ...
2
votes
2answers
76 views

Optimizing nested “Select Distinct” query

I am using the following query which is causing issues. Note following points: I am using 4 tables in this query: message_share ...
3
votes
3answers
223 views

A child ID getting all parent IDs

Is there any MySQL function that will optimize this code? ...
4
votes
1answer
70 views

Random select in two MySQL tables

I wrote a simple AJAX request that performs a random select in two MySQL tables. The thing is, my current script involves connecting to the database and creating a new PDO every time the ...
3
votes
1answer
64 views

Inserting data in 3 tables of a database with JPA

I am starting a personal project and my first step is to insert a lot of statuses from tweeter in a database along with it's user and place (if applicable). This is the database structure: Pretty ...
4
votes
3answers
104 views

SQL design for representing a two-level hierarchy of objects with containment

I am trying to represent questions in quizzes. The database is Mysql but I am using fairly generic sql. The assumption is that varchar cannot handle more than 255 though, so I am supporting longer ...
2
votes
3answers
298 views

Check if URL contains different strings

The code it self is pretty self explanatory, however i do not think it is very efficient at all. Is there a better way to do this? Its basically so i can track spam sites and save the sites into my ...
3
votes
1answer
34 views

MySQL SELECT from two tables with different situations

I'm trying to select two groups of countries with different situations. ...
4
votes
1answer
177 views

Extendable PDO Wrapper Class

I've created a PDO wrapper. I understand PDO could be used on it's own, and I'm reinventing the wheel as there are solutions like Laravel's Eloquent that would do a better job. I'd like advice on ...
5
votes
3answers
238 views

Extracting certain records

The purpose of this SQL query would be to extract the record 10192 only, because the end_time is both in the past and its foreign counterpart in the Node table ...
7
votes
3answers
483 views

MySQL update with PHP; MySQLi prepared statement in loop

I'm going to develop an Android application that performs simple MySQL operations by invoking server-sided PHP scripts. PHP-MySQL communication is done by MySQLi extension. Each operation that I'd ...
5
votes
1answer
50 views

I think I should use JOIN but I did this instead

Let me start by saying that I am brand new to PHP and MySQL. I have two tables. One table is called domains and it contains the "rep" column which is an integer. It is related to the column "id" in ...