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
3answers
39 views

Database select script

Is there any way I could improve this script, such as by writing it in fewer lines (more efficient)? I'm very interested in keeping my code dry and fast! Also, if there is a way to make it more ...
4
votes
3answers
106 views

Preparing and executing MySQL SELECT query from parameters

I am trying to make a function for Select statements. It will give result based from the parameters passed. I tried using it and it gives the results I am expecting. I know that it is still ...
7
votes
2answers
285 views

Securing PHP shopping cart

I've managed to create a working shopping cart and my next concern is security, mostly about the architecture and session security. Should I make sessions somehow secure, if there's no authenticated ...
0
votes
0answers
15 views

MVP pattern reading values from database [closed]

I need help im new with MVP Pattern structure coding design, i'm using MySQL as database and i need to display the patient data from a click event in the GridView then PatientForm will show. The ...
0
votes
0answers
4 views

Cakephp Career Database Design [migrated]

I am new in cakephp, I want to develop a simple career website, I have design the database, but i would like to show it to professionals and know if the structure is ok Jobs Table -id -job_title ...
4
votes
0answers
33 views

MySQLi library for handling MySQLi interactions

I wrote this class recently to better structure and handle MySQLi related interactions with PHP and would love to get some feedback. ...
-1
votes
1answer
27 views

Listing blog post excerpts

I have created many sites that requires php and html. They all work fine, but I'm now thinking if all that time I do it in a wrong way. Usually, first I build the site template, then styling and last ...
4
votes
0answers
30 views

SELECTing percentage and count of votes

I have the following tables structures: ...
1
vote
1answer
32 views

Performance of summing one value from join of three tables

I have a table I want to get a sum of information on, but the value I need to query on is in two different tables. The one with values I need to sum is say, kudos, which has a value indicating +1 ...
2
votes
1answer
43 views

Placing navigation items into an array

I am looking for better ways to write this code. At the moment it grabs a list of all navigation items and places them into an array (using PDO). However, as you can see, it is using two ...
4
votes
1answer
18 views

Youtube OAuth security

I am working with Youtube OAuth for the first time and I am not that great when it comes to security. I got the following code and would like to hear if you guys can find any security issue: ...
1
vote
1answer
34 views

Laravel time-punching database structure

I am trying to build a database structure for a time punching system. What I'm trying to figure out is if what I have is the ideal structure, or if something else exists that I'm overlooking. I want ...
2
votes
2answers
41 views

Performance of MySQL helper class for VB.NET

I have inherited this code from my company. It is acting as a helper class for a database and written in VB.NET until date. It is working properly and almost 5 to 10 commercial packages I am ...
4
votes
2answers
42 views

Shopping cart login and coupon code validation

I am figuring out how I could make the following query more secure: I have already used mysqli_real_escape_string but I doubt that adds much to security. I have ...
0
votes
0answers
31 views

Converts large csv dataset to hash then imports into MySQL/SQLITE3 database using Sequel

The main line in this script that allows Sequel to insert records into the database table is ...
1
vote
1answer
73 views

Hibernate insert with foreign key

Ι have the following database: ...
0
votes
1answer
40 views

Solved the problem. Might some cleanup and/or advise

I wanted to display 1 outcome of 1 single custom field or attribute in the category overview, using a third party customfield extension in my J! and VM website. I got it working using the code below. ...
3
votes
1answer
42 views

MySQL class that handles sanitization

I've written a MySQL class that handles sanitization of different data types. The reason I used this (and not prepared statements) is because this can be more dynamic. Prepared statmenets only ...
3
votes
1answer
66 views

Python CSV command line tool to import CSV into MySQL

I've written my first Python program longer than 15 rows and, of course, it looks terrible. I'd be very glad to receive comments and suggestion about how to implement a similar tool correctly. ...
1
vote
1answer
22 views

Shoping cart code using a loop to print multiple times [closed]

This code belongs to a shopping cart which I want to print multiple times with the help of a loop. There are 9 SQL queries and I want all these queries to run at a time with the below table every ...
4
votes
2answers
279 views

Efficient use of MySQL Connections with Java

Background: I'm building a dynamic in-house on-call roster that will be displayed on a web page. The end user will be displayed a list of people who are currently (at the time of the database call) ...
3
votes
1answer
58 views

Checking referential integrity of a database schema

I am using PHP PDOs to parse the results I am receiving from MySQL queries against a database. I am now running into an issue with running out of allocated memory. Are there any suggestions on ...
1
vote
2answers
163 views

Am I correctly implementing PHP/PDO and the MVC/DAO pattern?

Context: I am working on the login module of a PHP web-application and I am trying to implement this using PHP/PDO and the DAO pattern. I would like someone to review the code below and let me know ...
2
votes
0answers
38 views

Fetching player data

I would like to select some information I have stored in my MySQL DB. I have 2 tables gameTable and playerTable. Now I want to get the gameTable and get the names and levels of these players. How do ...
2
votes
1answer
96 views

Class method to insert a record into MySQL

I'm just starting out using OOP; classes and methods etc. I've been looking around for some PDO classes/wrappers out there, but there's not much to choose from. So I've tried to make my own. Started ...
6
votes
1answer
43 views

Is there a better way to split out join'd table data?

Consider the following segment of code: ...
4
votes
2answers
368 views

Importing MySQL Database to a .txt File

We just finished working on a Database project in Java Netbeans. We added the feature Import which will import the database record of one user to a text file. ...
3
votes
1answer
71 views

Matchmaking system - sorting musicians by skills, genres, and location

I'm making a matchmaking system using PHP and MySQL which allows users to search through a list of musicians so that they can find people with the right skills and interests who are near them. It ...
1
vote
1answer
91 views

PHP PDO / MySQL helper/wrapper functions

Further to my previous post for a user login script I've been learning PDO in order to migrate from mysql_* functions. As before with mysql_*, I wanted to wrap the PDO code into wrapper functions, so ...
-1
votes
2answers
49 views

MySQL query in nested loop to get scores and averages for students

I am trying to get the scores and average for all assignments for records in a MYSQL database. The code below works but seems to take quite a bit of time to run because of the nested while loop. Any ...
0
votes
1answer
77 views

Combine Mysql limit query

Is it possible to combine these queries into one query? I am trying to see and average all scores but also count and average just the last three based on the same grouping. This is the main query: ...
3
votes
1answer
25 views

Virtual Airline Dispatch Generator

This Code is old and I am trying to figure out how to improve it. I am considering running the distance function in MySQL, but it is a ***** to figure out for me due to my experience with arithmetic ...
6
votes
5answers
417 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 ...
6
votes
2answers
78 views

Database access concept

I've got a small tomcat web application that's used to receive customer data from an iPad app. After receiving those information they will be saved on a local MySQL database and then sent to an SAP ...
1
vote
1answer
167 views

Two tables for storing comments

I have two tables for storing comments comments ...
4
votes
2answers
490 views

Voting system for a website

I am currently adding a voting system to my website. Below is my voting class. I feel that it could be simplified and that there is repeated code regarding the functions, although to the best of my ...
1
vote
2answers
63 views

SQL Data Fetcher for CMS

I am creating a CMS for a website, so I've added most of the functions that will fetch data from the database to a separate class. The code doesn't seem to have any bugs(Since I've tested it) but I ...
5
votes
1answer
257 views

Efficient Pandas to MySQL “UPDATE… WHERE”

I have a pandas DataFrame and a (MySQL) database with the same columns. The database is not managed by me. I want to update the values in the database in an "UPDATE... WHERE" style, updating only ...
3
votes
1answer
81 views

Custom session handler

I'm new to PDO and haven't been coding in a while. Is the following custom session handler industry-acceptable? ...
3
votes
1answer
43 views

Join - order by vote-sum and check if user has voted

I have a vote and a comment table. Now I want to display all comments and order them by votes-sum. Sum because some votes can have a higher value than others. Therefore I want to display if the user ...
3
votes
3answers
475 views

Cron PHP script to pull newly added clients from remote db, add their information to local db

I wrote a PHP script and was wondering if it was well written or if it could be improved upon to read or run more efficiently, any help or critique would be greatly appreciated. The file will be ...
3
votes
2answers
63 views

Small library for logging to MySQL

I've thrown together a utility for my programs to log to a database, but the code looks like a mess and I don't know how to clean it up. This library is going to be used from all of my other programs ...
6
votes
1answer
39 views

Implementing EXCEPT functionality for social networking exercise

I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises. The following is ...
2
votes
1answer
52 views

Simplify SQL query that utilizes GROUP BY and HAVING BY and uses aggregation

I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises. The following is ...
3
votes
2answers
131 views

Is my login system secure?

I am recently making a CMS and I need a secure login system, so this is my code. How is it? First: the HTMLcode for signup and login: ...
3
votes
1answer
41 views

Query about advertiser calls times out

I'm a bit of a rookie MySQL coder and I've been tasked with building a query that will join and filter several very large tables (one with ~210 million rows, one with 10 million, one with 2.5 million, ...
5
votes
3answers
64 views

Performing database interactions

I wrote this CRUD class in PHP that has methods to do database interactions, but I want to know if it is good/secure/elegant? It works fine and all and it hasn't ever given me any troubles, but I'm ...
3
votes
2answers
148 views

Finding max rating for a movie

I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises. The following is ...
3
votes
2answers
102 views

Displaying a random poem from a database

I'm new to web development, and I'm constantly torn between good code and bad code. I was wondering if you could help me improve my following code and see if I'm doing it right in terms of how I use ...