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
7 views

PHP if doesn't work [on hold]

I have wrote a php class for checking captchas into a database but when I check if it's null into the database, the script returns true even it's false! here is the piece of code: ...
-1
votes
0answers
15 views

Flask, Python, MySQL - Query with parameters works locally on dev but not on the production server [on hold]

This issue has stumped me. Locally I'm using Anaconda and running python 2.7. I serve my Flask app using run.py but connect to my actual database (hosted by dreamhost.com) even in the "dev" ...
2
votes
1answer
36 views

java.sql.Timestamps: There's gotta be an easier way

I have a function that counts how many "assists" a team performs during the course of their day. The way I've written it feels bulky and inefficient using GregorianCalendar. Basically, the ...
-2
votes
0answers
19 views

PHP Login System [closed]

I am trying to make login system but i could put nothing in the username and password bar and it still takes me to the users page. I just wanted to know if anything i have here needs to be changed or ...
1
vote
2answers
29 views

Displaying completed and failed wuuks using one or two functions

I have upgraded my code. In the old code I had two functions: display_maker_success() and display_maker_fail(): ...
1
vote
2answers
50 views

Database migration script

I'm working on a database migration script written in python, which will take data from a MySQL database and insert them into a PostgreSQL database with a different Schema (different table structures, ...
5
votes
2answers
87 views

Inserting a Java object into a MySQL database

I'm writing a method to insert objects into a MySQL database and while everything runs fine I feel my code is bulky and inefficient. What steps would you take to make this code more pleasant to look ...
2
votes
1answer
75 views

MySQL data fetching without page refresh

I've recently finished a prototype for a little Raspberry Pi website. The main page of the site displays current users found in the room (through bluetooth). I wanted this list updated regularly from ...
2
votes
1answer
62 views

Database Connection Program

Earlier today I asked a question as a guest (whoops) regarding my Database program. I could not comment nor post again asking for further advice from the people that answered my question. I have ...
1
vote
0answers
26 views

User model with user roles in Codeigniter PHP/MySQL

I am building an app that currently allows the users to have 3 different roles: Consumer Merchant Admin I have three tables: user (Name, email, password etc with a status=0/1) user_role (The ...
3
votes
2answers
99 views

Database Connection Program With HR Functionality

I've started writing a fully functional Database program in C# that allows a user to access a HR system (with more systems planned in the future). I have come over to C# from Java around two weeks ...
5
votes
2answers
60 views

User auth class and security

Just curious if my authentication is secure enough, really. Also wondering if I should ditch the secret variable and just use ...
-3
votes
0answers
19 views

MySQL - rewrite a heavy multiple child-nested queries query

I'm on a task to improve an app's DB query. This heaving-loading query takes roughly 3-5 minutes to complete which is unacceptable. The previous developers built this query and they didn't do this ...
3
votes
0answers
13 views

Obtaining employees and their roles, and vice versa

I am using the following query to obtain a employee with his information, and get all his related roles. The query underneath works fine when we check only 1 location taking only about 0.002seconds to ...
-1
votes
2answers
68 views

Accessing a list of websites using a configuration read from an XML file [closed]

I have a C# application and a CakePHP website. These communicate between them using GET and (WebRequest) POST method. My problem is that it's happening too fast. I have made a diagram that shows ...
1
vote
0answers
21 views

Util method for generating an INSERT sql dynamically

I'm currently building software that: 'talks' to Google Analytics API, fetches data, persists the data to a MySql db. Insertion of data into the db needs to happen automatically - based on the ...
2
votes
0answers
29 views

Using QSqlQuery::bindValue() for variable number of placeholders

I am familiar with the simple use of QSqlQuery::prepare() and QSqlQuery::bindValue() as in: ...
0
votes
1answer
47 views

PDO lastInsertId

In my shop system I'm using the PDO lastInsertId to assign the order_id to the products that belongs to it like this: ...
1
vote
1answer
70 views

PHP script to connect to MySQL database using PDO

Introduction I am preparing to use a basic script to cover how you can connect to a MySQL database using PDO. This script is meant for educational purposes (introductory class on PHP/MySQL) and does ...
3
votes
1answer
32 views
0
votes
1answer
27 views

Applying prepare statements

I don't feel that my code is secure, and would like some help in using prepare statements for the following; ...
-2
votes
2answers
75 views

Using a lot of IF in loop WHILE to print information

I made a code and it is doing what I want. But, I would like to know if I am doing it right or in the best way. Could you please give me your thoughts about it? Thank you. ...
0
votes
1answer
19 views

Indexing columns to make a MYSQL query faster

I have this query here that I am trying to make more efficient as it is taking an extremely long amount of time, about 40s on 3 million records. The query basically takes X amount of rows per company ...
1
vote
0answers
29 views

Archiving an SQL table of sessions and statistics

What my query is doing: I have two SQL tables and I want to copy datarows from the one table to the other table. I am doing this for statistics. The source table includes all current ...
2
votes
2answers
81 views

Registering usernames and passwords to a database

Here is my script that registers a user to a database. I am still very much a newbie when it comes to this topic so any guidance would be greatly appreciated. ...
0
votes
1answer
52 views

Update live table in MySQL

After populating the stock_tmp table, i'm running these SQL queries via legacy mysqli wrapper code. I don't think this code ...
1
vote
1answer
26 views

Selecting mail messages that meet one of four search criteria

This is the current very repetitive and long SQL I have. Unfortunately I'm not that good at SQL to group this and get rid of the repetition. ...
3
votes
3answers
63 views

Grabbing hashed password from a database

I have just discovered the beauty of prepared statements in PHP and how they protect against SQL injection. In my first time using them, I am attempting to grab a hashed password from a database and ...
0
votes
2answers
134 views

MySQL JOIN to JSON array

I'm building a HTTP API and this part should return a JSON list of posts and their attached photos, like this: ...
5
votes
2answers
44 views

Volunteer Signup Report

I was creating a Volunteer Signup Report report in Microsoft Excel yesterday for my job and I had a moment of inspiration. What if I turned it into a website and made it dynamic? The volunteers sign ...
6
votes
2answers
90 views

Password recovery program

This is a password recovery program I made, and I just want it checked out. These aren't all the files for the login and register system, only the password recovery part. The columns in the ...
4
votes
1answer
69 views

GUI SQL interface for select insert and remove

This is my final project for my second Java class! I would like to get some feedback on it to see where and what I can improve. There are five class files: ...
1
vote
1answer
93 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 ...
6
votes
1answer
133 views

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
58 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!). ...
3
votes
1answer
214 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
votes
1answer
61 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
71 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
22 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
81 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
91 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
60 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 ...
5
votes
2answers
57 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/...
3
votes
1answer
76 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 ...
5
votes
1answer
145 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
37 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
39 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
158 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
121 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 ...