MySQL is an open-source, relational database management system.
2
votes
1answer
95 views
How can I improve this PHP MySQL rank query?
In my db MySQL, I have a table ranks with many fields, one for each page I want limit access for the user in the menu application with PHP control:
<?php if ($row_ranks['padric'] == '1' ) {
...
5
votes
1answer
67 views
Best Practices concerning Includes and SQL Connect Strings
I'm just starting to learn PHP. I have three random questions about PHP and one question about Code Review. None of them are technical questions ("will this work?"); they're best practices questions ...
6
votes
2answers
148 views
Register script security and optimization
function RegisterN() {
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if (isset($_POST["password"],$_POST["password1"]) && $_POST["password"]!=$_POST["password1"]) { # Check if password and ...
5
votes
1answer
73 views
System for inputting and monitoring worker shifts
I've been building a system for inputting and monitoring shifts for casual staff, who work across multiple sites with the ability to generate accounting information.
I've had some help from Stack ...
2
votes
1answer
107 views
Optimize MySQL in a stored procedure
How should I optimize my code for better performance? When I execute the code outside of MySQL stored proc it is 500% faster.
MySQL stored procedure
SELECT bs.business_id, adr.street, bs.`name`, ...
3
votes
1answer
68 views
Query optimization PHP for string concatination
I have an entity RegistrationForm which has a OneToMany-relationship with SurveyAnswer.
An answer can either have a collection of FormOptions (when the answer is of type MULTIPLE_CHOICE) or a ...
6
votes
1answer
48 views
MySQL in Vb to update every field of every page of a form in the database
I have a VB code here that connects to a MySQL database to update every control on every page of a form in our database.
I am told is taking longer than it should to run. Comment 'Setup MySql ...
3
votes
1answer
55 views
Searching for news articles in database
The first thing I would like to say is that I do have a fully functioning script, but the script is ugly, and I am wondering if there is a way to optimize it.
The script looks to see if I have at ...
1
vote
1answer
46 views
Update SQL query using UNIX time
I would like to test the following garbage collector code on a database of sessions.
It should be following the conditions below:
if 'remember me' is enabled by the user, then it should delete all ...
5
votes
3answers
202 views
Is my MySQL library wrapper neat? How can I do better?
I'm moderately new to programming in C and I'm not sure about programming practices with code; suddenly I have had fears that my code is messy and disorganized. I can read it when I come back a month ...
3
votes
2answers
86 views
Is code optimization for branch predictor necessary now?
I would like to share a part of some code written several years ago (I have changed from mysql to mysqli); this code works perfectly. I am new to my company, and our senior programmers wrote some ...
5
votes
1answer
76 views
Python Connection with MySQL
I want to share something with this community. I did a class connection between Python and MySQL. I hope you can help me with this project and help me do a better class.
Here is the class ...
1
vote
1answer
67 views
Checking a mysql connection and refreshing it
I am using the following function to check if a mysql connection is in an invalid state or if it has reached a predefined maximum operation count:
/// <summary>
/// Holds the amount of ...
4
votes
1answer
136 views
Optimize MySQL double select inside for-loop
I want to get the number if items with state 4 and 1 from my database for each day between a certain date. Is there a smarter and more performative way than this one?
I am aware that I should use ...
4
votes
2answers
169 views
My API Keygen: Is it secure?
Below is an api key gen script for a cryptocurrency trading platform i am building.
first it checks to see if a key exists in the db for the user id. if it does exist it displays the key. if it ...
2
votes
1answer
225 views
PDO Login/Register system review
I wrote my very first login/register PDO system today. I know there is still a lot of flaws, but I was wondering what tips and advice you have to help me improve this. I know that PDO is much more ...
0
votes
2answers
119 views
Dumping a MySQL database to a file using a PHP script
I know there are countless questions on SO, and several articles on the web regarding this subject, but after looking at all the options, I was moved to write my own code to address my own ...
7
votes
2answers
68 views
Servlet for querying database on some high-loaded system
What should the code do: Process client HTML requests, query database and return the answer in XML. Working with a high load.
I need to know how can it be optimized.
Is something terribly wrong with ...
4
votes
1answer
72 views
Need help optimizing PHP/MySQL code snippet
I am sorry for the simple request, but I'm trying to figure out the best way to optimizing the following bit of code. I hate using 20 lines of code when 12-15 will suffice. I also don't like having ...
4
votes
1answer
78 views
Make this MySQL query more elegant &/or efficient
I have created a MySQL query that works, but I feel there must be a better way. The query will be used by a PHP script whose purpose is to assign conditions & subconditions to new participants in ...
2
votes
1answer
61 views
Normalization: is it done well? [closed]
I am creating game review database. I am new at this, but I am trying my best. Little bit about database: The system is simple, the user will fill out a form, where they will insert their name, email ...
2
votes
1answer
48 views
How to optimize the code in order to reduce the loading time of page?
I'm using PHP, MySQL, Smarty, jQuery, etc. for my website. I'm using a MVC architecture to develop the website. Now in one of the functionality I'm fetching a large amount of data and perform some ...
2
votes
2answers
64 views
Does this query affect perfomance?
I have this query:
SELECT * FROM
(SELECT u.id,u.email,u.verified,u.verified_on,u.created_on,ca.html AS age,cg.html AS gender,cs.html AS state
FROM users u
LEFT JOIN combo ca ON ca.combo_group='age' ...
6
votes
2answers
119 views
Local user registration
More javascript (nodejs) to go with the passport wrapper I just posted:
UserBook.js
/*
* A wrapper for user Registration for a web site.
* This is an MYSQL version of the client to provide ...
3
votes
2answers
68 views
Optimized Query
I am having a structure of 3 tables
Table mintemp consist of matcode,min_qty,jo_no,mr_no
Table min_out_body consist of matcode,out_qty,jo_no,mr_no
Table eu_min_out_body consist of ...
2
votes
1answer
33 views
How do I use JOIN instead of IN in this query?
I need a query that results in similar products based on number of common tags. For example similar products of product A (with T1, T2 and T3 tags) should be something like this:
product B | T1 - T2 ...
5
votes
2answers
116 views
Is there a way to shorten and/or simplify this Select Statement
I have the following MySQL SELECT statement. It is working fine except that the code is too long. I have been looking throughout the Internet to figure out how I can make it shorter.
SELECT regd, ...
2
votes
1answer
45 views
Class method with begin transaction and return errors
I've created a method which is useful for executing multiple queries, and it works perfectly. Is this a good way to handle this?
public function foo($rQuery)
{
try {
...
1
vote
1answer
67 views
Login and User Information Requests
I am trying to improvise a piece of code. The best is to get reviews from experts, so here I am.
Can you have a look? What do you think of it? Any suggestions? This code basically connects to a ...
3
votes
0answers
130 views
How can I optimize this query to improve performance? [closed]
I'm building a wordpress website using advanced custom fields and the repeater plugin. I've managed to put this query together after re-organizing my data using the repeater plugin. The query below ...
1
vote
1answer
173 views
Test my script for vulnerabilities
This is a trade script for an online Virtual currency exchange I have been developing. We have a team of 3, and we all work in our own trees. Since we're all young and not very experienced. we would ...
3
votes
1answer
70 views
Help with optimizing current data pulling fuctions
Here is what the below code does:
The first function, sqlPull() connects to a local MySQL database and pulls the last 20 rows from the database every 5 seconds. The data coming in is a list of ...
2
votes
1answer
69 views
Review request for interactive table
I've got a page on a website that shows a table, and upon clicking on a row in the table it can dynamically load in more results. I am new to JQuery though.
index.php page:
<!DOCTYPE html>
...
1
vote
1answer
61 views
How to improve my PHP adding script?
I have a script, which updates my table's column and writes an id to it.
I need to check whether the column is empty or not. If it is not, I add a ,.
$subs = mysql_fetch_array(mysql_query("SELECT ...
2
votes
1answer
53 views
Wordpress filter post by metavalue
I am making a filter to get posts by status that are saved by post metavalue in a Wordpress plugin. It is a question and answer system, where the question and answer are post objects.
// Filter ...
1
vote
2answers
280 views
SQL database design e-commerce
I am new to database design but am fairly familiar with SQL and its syntax. I want to create a database for an E-commerce website that will sell a single product type such as a shirt. They could be ...
3
votes
1answer
58 views
Better SQL query for monthly bills
I've written this query and wish to know how it can be improved. I'm not comfortable with JOINs and willing to learn.
The idea is to get a listing of monthly bills with amounts paid. The subquery ...
5
votes
2answers
91 views
Improve query: find users who are neither friends nor fans of a user
Please take a look at this query and try to give me any other ideas that will give the exact same results more efficiently.
SELECT username
FROM users
WHERE username NOT IN (
SELECT DISTINCT ...
0
votes
1answer
51 views
Missing or introducing too many characters on mysql php post form [closed]
Please help me see what I'm missing, since I received an error at this row:
"'" . $_POST['credit_card_expiration'] ."',".);
I'm getting a headache of all the characters at the moment.
<?php
...
1
vote
1answer
91 views
Database schema suggestions for a Minecraft logging plugin
This is my attempt at creating a database schema for a Minecraft logging plugin. I'm by no means a SQL expert, so suggestions would be greatly appreciated.
--
-- Table structure for table `actions`
...
3
votes
3answers
281 views
Please review my PHP MySQL login
I'm trying to learn PHP/MySQL and the likes, so I've been reading tutorials for PHP login systems. My current iteration is based heavily on one from this website and contains the accepted answer for ...
3
votes
1answer
80 views
Review/rate my new graph class
I have written a PHP class called "graph". It is a class that performs RESTful-like commands to a MySQL database. I have posted the GitHub repo.
Here is the code as well:
config.php
<?php
...
1
vote
1answer
42 views
Code tidy-up for multiple queries
I have the following code that I know can be written in a better way. Basically I query tables and display the results for each student for the homework that has been marked.
<?php
include ...
2
votes
3answers
202 views
choice of tables for a project to handle attendance
I'm working on my project in php [handling students attendance system]. I have a list of students along with their id[jntuno] and I need to create a database in mysql for storing the daily attendance ...
3
votes
1answer
61 views
Query builder improvment
I've got the following query builder. Some of the cases have the same piece of code (those that have a parameter).
I know it's not good to duplicate code that much if at all.
How would you suggest I ...
2
votes
1answer
253 views
Optimize PHP and MySQL with PDO
I am updating some old reports that are using mysql_ statements and trying to use the MySQL PDO stuff. I was told that PDO is far better since I was running into runtime issues with some of my ...
2
votes
1answer
80 views
Correct use of my JOIN and arrays to fetch the data?
After learning a lot about programming, I've decided to write some code pertaining to scripting and use of different functions. I've come to a point where I'd like others to verify my code for ...
0
votes
2answers
130 views
Simplify MySQL INSERT query
Is there a way to simplify the code below? I want to simplify it, but I don't know if it is possible.
In the table below, I insert data which will end up in a MySQL table.
HTML
<table ...
0
votes
1answer
95 views
How can I make this piece of code more secure?
I am using db_dataobject and have provided two examples of an insert and a select query below.
Can you please help me rewrite them in a more secure way using PDO? Is there any other way to improve ...
1
vote
1answer
484 views
PDO class for multiple databases
I have PDO class below:
class DB {
private $dbh;
private $stmt;
static $db_type;
static $connections;
public function __construct($db, $id="") {
...