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

0
votes
0answers
7 views

PHP won't connect to MySQL Database [on hold]

I'm trying to create a login/register system, though I'm having some problems adding the information to the database, here is my register.php. ...
1
vote
1answer
52 views

DatabaseManager and connection in C#

I am posting here to get a code review on my DatabaseManager and DatabaseConnection classes, and for answers on how I can improve. I won't spend too long drolling on, but this is a database manager ...
4
votes
0answers
44 views
+100

mysql_safe_query()

I have been thinking of a sql-injection free implementation in dynamic languages. Here's what I came with. All the code was written just for fun and learning purposes. I would like to share it and ...
5
votes
1answer
31 views

Impyla parse user args into SQL query

My Python is super-rusty and I feel like there must be a better way to do the following. I would really appreciate any feedback/pointers so that I can improve my code and skills (or lack thereof!). ...
-2
votes
0answers
13 views

using JSON for passing variable from query to javascript? [closed]

I want to use hicharts graph for that i have to transfer my PHP data to javascript, i am stuck don't know how to do it, PHP code is ...
3
votes
1answer
116 views

PHP class architecture and dependency injection

Let me start off by saying I am not new to PHP or PDO, but very new to OO PHP, and have been struggling to get a firm idea of best practices in my head regarding dependency injection and structuring ...
1
vote
0answers
13 views

Server framework

I decided to abstract out some of the code I use in personal projects into a library. In particular, it'd be used primarily for server-side programs, but I don't see any reason it wouldn't work fine ...
-1
votes
1answer
49 views

MySQL security in PHP

I'm creating a database class. It's part academic and part something I may show in an interview. The purpose of this method is to accept a table name as a parameter, check if the PDO Object has been ...
2
votes
1answer
55 views

Retrieving result sets from a MySQL table

This retrieves result sets from a MySQL table. The objective of this function is to correctly retrieve any number of rows (with $sql) from a MySQL table, binding ...
1
vote
0answers
17 views

Find nearest location

I am trying to implement a "find nearest location" from a given latitude and longitude using MySql. I have 8000 locations stored in my WordPress website. I managed to write this: ...
4
votes
1answer
68 views

Hotel reservation system with discounts and deposits

I'm making a hotel reservation app that has the following features: Promo Codes: The guest can choose to pay half a certain percent of the total_amount or the ...
1
vote
0answers
79 views

Login authentication model

I have made my model global so that I can work only a model with several controllers. Is it good or bad practice? And according to this, is my login process secure? Login check function in ...
2
votes
1answer
43 views

Function to streamline PDO statements

This function arguably has little use as it's so simple, but I'm writing a web application with a lot of SQL statements littered all over the place and I thought this function might reduce code ...
4
votes
2answers
47 views

Conditionals for time specific data (SQL style)

I was inspired by this question from @AndyRoid to try and come up with some fast and accurate datetime calculations that didn't involve complex if/else statements. My hammer tool of choice was ...
3
votes
1answer
74 views

sed-like attempt from database

The following code and test data works, but I have had to add delays between writes to MySQL otherwise it acts funny (especially on the target data set which is over 700 rows). The table is simply a ...
-4
votes
0answers
27 views

Issue with HAVING in SQL query [migrated]

This does not work and returns error: SELECT EAN FROM eTovar WHERE EAN GROUP BY EAN HAVING parameter_id IS NULL Error in query (1054): Unknown column ...
5
votes
1answer
128 views

Website user password verification

I have a login web page where a user enters their email and password and I need to check if: the entered email exists in the DB and the entered password matches the hashed one from the db. The ...
1
vote
1answer
35 views

Query containing array

I want to get the query result that contains all entries from array and some data from the DB. It's like the array is a DB table and by left join I connect the data ...
3
votes
0answers
27 views

Database syncing playback of videos

I made a website last night that allows people to sync HTML5 <video>s (playing/pausing). The way it does this is by using Ajax to run a MySQL query every 2 ...
3
votes
1answer
149 views

Query SteamIDs for presence of an avatar

I have a table vanrust_corev2.tblPlayerLog that has approx 6.7k records, I also have a table in a different database ...
7
votes
1answer
102 views

OR vs UNION in message tables

I have a dilemma. I have a messages table containing fields id, sender, receiver, body I need to select all users a given user has had a conversation with. A ...
2
votes
1answer
30 views

Using view for repeated subquery on a large table

I have a large table with which I need to do some analysis. The table is a log of IPs: ...
2
votes
1answer
37 views

Restaurant booking subquery

I have two database table name called "tablestr table" and "restbookingtable": tablestr: restbooking: I want to retrieve bookingsection_id from the booking ...
2
votes
2answers
57 views

Storing customers' orders

I'm developing a shop system and using this method to store the customers with their respective orders: ...
1
vote
1answer
46 views

Medical database design and queries optimization

I have created a MySQL database which will be used in a medical app, but I am pretty sure the design and the used queries can be improved, since I am new in database design. My biggest doubt is the ...
7
votes
4answers
383 views

Preventing duplicate numbers from being entered

I recently wrote a program involving a MySQL database using C#. The program is simple: it allows users to enter numbers and ensures that no same number is entered twice. Now I know that it is not ...
2
votes
0answers
42 views

Processing database data into a multidimensional array

The purpose of this code is to get data from the database and output it into a multidimensional array in JSON for my web app. But my gut instinct is telling me this code is way too messy and just ...
-1
votes
1answer
48 views

optimize mysql taking too long

Today I made a clumsy update without WHERE. Yeah, I know. I have backups but I found a way to fix it without loosing anything. It implies a ...
4
votes
1answer
76 views

Selecting and inserting MySQL records using PDO

This PHP class connects to and queries the database MuSKL. I am a novice, and I ask you to comment on the approach and style of code. ...
4
votes
3answers
58 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
267 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
583 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 ...
5
votes
1answer
73 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
33 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 ...
7
votes
1answer
52 views

SELECTing percentage and count of votes

I have the following tables structures: ...
1
vote
1answer
38 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
44 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
23 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
39 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
79 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
78 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 ...
1
vote
1answer
247 views

Hibernate insert with foreign key

Ι have the following database: ...
0
votes
1answer
44 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
51 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
200 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
27 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
301 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
72 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 ...
0
votes
2answers
286 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 ...
5
votes
1answer
91 views

Fetching player data

I would like to select some information I have stored in my MySQL DB. I have 2 tables named gameTable and playerTable. Now I ...