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

learn more… | top users | synonyms

1
vote
0answers
25 views

I'm looking for suggestions and comments on my simple search algorithm

I'm not looking to be a google replacement. I'm planning on using this for the internal search for a web application I'm working on... phpfiddle sqlfiddle php - The $search_string variable is the ...
0
votes
1answer
48 views

How to change my code to jquery

I have wrote few function that grab the values from a form page and pass them to PHP is there a way to write it better function resultstype(form) { var ...
0
votes
1answer
114 views
+150

Review my ruby for performance

So I'm using the acts_as_taggable_on gem to tag 3 different models: Question, Blog, and Video Each one has a site_id to distinguish which site they show up on (SaaS-ish). I wanted to get all tags ...
0
votes
0answers
16 views

Getting user interactions

Okay, so here's the table schema I have to work with (simplified for convenience): CREATE TABLE `users` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(16) COLLATE ...
1
vote
0answers
32 views

Pages system PHP/SQL

I'm working on a CMS, currently on being able to create static pages, manage menus etc. so.. I have This function that reads from the DB and finds all the static pages, and their position in the menu. ...
-1
votes
1answer
44 views

Speed up mysql query with IN clause to much

I try to improve the speed of my query in mysql but when condition IN clause to much. the query run very slow. Anyone can help me to optimize the query here. Thanks for any Help EXPLAIN SELECT ...
-2
votes
3answers
61 views

Which of the following two mysq queries runs faster? [closed]

Could someone say which runs faster as data size increases? E.g. when Size = 10, 100, 1000, 10000 Using Aliased Nested Query in From select a.ID, a.updated_on, a.group_name, a.list_name from data a, ...
0
votes
3answers
105 views

Can this code be simplified even further?

Can I make any further improvements to simplify / speed up this code? My reason for creating new arrays for the variables $name, $business, $email, $orderstatus is because when displaying results ...
0
votes
1answer
51 views

Can this code be improved upon?

My code already works 100%, just trying to figure out if there is an easier, better or speedier way to do this. Outputs to an HTML table to display results. Something that took me a while to figure ...
1
vote
1answer
43 views

Improve my SQL select statement

I have three tables for a blog system. The blog CREATE TABLE IF NOT EXISTS lm_blog( blog_id INT UNSIGNED NOT NULL AUTO_INCREMENT, title VARCHAR(80) NOT NULL UNIQUE, action ...
1
vote
1answer
57 views

MySQL vs PDO execution time

I'm having some issues understanding why PDO is 6X slower executing a query than the depreciated MySQL query function. Here's my code: $conn = new PDO('mysql:host=localhost;dbname=work', 'root', ...
1
vote
1answer
47 views

SQL Query efficiency within class

I'm trying to figure out whether I should do the following: This class (over-simplified version) retrieves information about an order by having 1 main query function that select a specific column ...
0
votes
1answer
22 views

Database “design” using Symfony2 and Doctrine2

I'm working on an application, which tracks expenses. I have users. Each user can create his categories for the expenses (like Food, Bills, Transport, Drinks, Clothes) and then create expenses - each ...
2
votes
1answer
46 views

A Better Way of Employing a Using Alias Directive

I understand .NET very well until Principals of OOP come into view, so I guess we can say very little. So to work on this, I am making a Console App that will Catalog my Digital Media to a MySQL ...
3
votes
1answer
56 views

Dynamic homepage with PHP - making things too complicated?

I am trying to show the 6 most popular products on my homepage from left to right, in two rows. My code actually works... but I have the feeling I am making things way too complicated. Is there a ...
1
vote
1answer
66 views

How can this layered PHP architecture be improved?

This is my first "large scale" system I've designed for myself. Since I'm more of a front end developer than backend developer, I'm not sure if my architecture is sound. I've created a Factory class ...
1
vote
2answers
68 views

PHP PDO mysql multiple queries mak

I ran into a problem, I'm using MyIsam tables in mysql database, using PDO to connect. In all my tests (calling for 1 user everything works fine), now having around 300 users connected at the same ...
2
votes
2answers
91 views

Optimise this mysql query

This query is serving me a home page for users where a user can see all posts by him/her and his/her friends. This is an excellent query without any errors but i only wish to make it shorter if ...
4
votes
1answer
68 views

Code Reiview for an PHP PDO Queries? is there a better way to do it?

so this is my code for a equipping an item in my game dev't: try { $db = getConnection(); $db->beginTransaction(); $sql_chara_gold = $db->query("SELECT chara_gold ...
1
vote
2answers
217 views

Using AJAX to look up MySQL value using two dropdown inputs

I have a list of cities, and a set of "travel time" between any given two cities. The "travel time" is fixed and not necessarily dependent on absolute distance between the two cities, and it currently ...
2
votes
0answers
46 views

Practical advise for CMS

I'm working on a CMS system. The basis is pretty much done but before going any further I would like to know if there are things I really should change in the way I code things. I am pretty sure ...
1
vote
2answers
100 views

Assist cleaning up messy HTML/PHP code

I really hate messy code, but I seem to be rolling in it. I just want to see if anyone has some helpful advice on how to tidy this up. <table> <tbody> <tr> <th>Zona</th> ...
1
vote
2answers
93 views

MySQL GEAR, C# class for ASP.NET project

I've developed my own class in ASP.NET project to access MySQL and make queries, scalars and read the result from it. I want you to review my class and tell me where did I make a mistake, thanks! ...
0
votes
2answers
99 views

JSON API in C++ with Node.native, RapidJSON, and MySQL

Hey folks, I was hoping I might get some feedback and ideas for improvement on this, particularly the WebRouter class. Any tips or suggestions would be great! #include <native/native.h> ...
2
votes
1answer
45 views

Is there a more optimized way for this MySql Query

with below query i'm getting the results that i want but it's quite slow taking nearly 0.2 seconds (on an i5 machine). Is there a more optimized way to get the same results. Basically this query ...
2
votes
1answer
68 views

Better way to have output code?

When a user is created, deleted and update the system will give feed back. e.g. User Deleted/Updated/Create success or unsuccessfully, but I'm sure there is a better way to do it than what I have done ...
2
votes
1answer
71 views

Clean PHP IF Statement

This script updates a mySQL data with golf scores and calculates how many strokes under the player is in real time and is working. Just looking for a better way to make it cleaner and compact. Any ...
5
votes
2answers
208 views

Strategy to create audit trails for a SQL database

I wish to create audit trails for specific tables and columns in my database, and document who made the change, when it was made, and what the change was. To do so, I will create the following ...
1
vote
4answers
187 views

Making this code 'more' OOP

I have just started to try and learn 'OOP' but it appears I'm doing this wrong, according to the people on StackOverflow the code below is far from Object Orientated, but I'm finding it hard as I'm ...
1
vote
1answer
296 views

Inserting data into database by Python

I have to run a python script that enters data into MySQL database table. My below query runs and inserts data into MySQL database. But I want to optimize it and I have 2 requests: I want to use ...
4
votes
1answer
97 views

Create a table from MySQL using PHP PDO

I am trying to simply present a table in HTML that is stored in a MySQL database. I would like to use Object Oriented PHP to access and fetch the data for the table. I have spent some time learning ...
2
votes
0answers
25 views

CONSTRAINT, FOREIGN KEY and CONSTRAINT FOREIGN KEY

Please check if my tables specs agree with business rules. And also please explain what differences between CONSTRAINT, FOREIGN KEY and CONSTRAINT FOREIGN KEY. I got 4 mySQL tables: USER, NAME, ...
-3
votes
1answer
105 views

My Social Network built on PHP + MySQL. Ideas needed? [closed]

Can someone check out my social network I've built and tell me what they think? I'm 13 and I built Zikzo.
2
votes
1answer
72 views

PHP ORM like system

I'm using PDO, but I want to create my own class for more convenient work with the database. My main idea in example with comments: <?php /** * User entity. I want to save it into database. * ...
3
votes
2answers
153 views

Is this code safe from SQL injection?

I believe with everyone's help on StackOverflow I got my code safe guarded from SQL injection, trying to confirm that is correct, just in case I misinterpreted the help and advice I received. ...
1
vote
1answer
39 views

MySQL limit across multiple tables in multiple queries

I have a website that keeps track of 'changes' that users make. These changes come in all shapes and sizes and each shape and size has a different MySQL table to store them in. In total there are 8 ...
0
votes
2answers
87 views

php script to retrieve enum values from sql table

I have an sql table with multiple fields and 4 of them are enums. I wrote a script that runs thought the table and retrieve the enums and put them in a 2 dimension array. Unfortunately this script is ...
1
vote
1answer
69 views

Keeping track of people's relationships in MySQL using a people relation table?

I am trying to track relationships among people. I came up with my own solution, but wondering if there might be another way or better way of doing this. To keep it simplified, I'll post just the bare ...
1
vote
1answer
59 views

SQL vs MongoDB (TCG collection managment)

I'm designing a web application to help some friends and I manage our card collection. A relational database makes sense to me, so that was my first instinct. The basic schema would like something ...
0
votes
0answers
15 views

slow mysql query - 1200 rows in 5secs

can anyone help me speed up this query? at present it returns 1200 rows in 5 secs. I notice it is looking at 240000 response records - think this is where issue may be I created the following ...
4
votes
1answer
53 views

Thoughts on organizing code for multiple mysql queries in php scripts

I have a web application where I connect with a MySQL database using PDO and in some scripts there are a lot of queries one after the other which don't necessarily concern the same tables. i.e I will ...
3
votes
1answer
78 views

Converting from MySQLi to PDO account activation

I had been working on a project for some time, and then it went on the way back burner after my daughter was born. I'm back to it, and now I discover that I'm best off using PDO over MySQLi. So, I'm ...
1
vote
2answers
68 views

Looking For a More Efficient/Elegant Way To Write a MySQL Query

I'm querying a MySQL database and displaying the info in order of timestamp (DESC). Essentially, I'm grabbing the last record in the database, displaying it's date and year as the header of it's ...
0
votes
2answers
93 views

PHP PDO Custom class ple

i created a database class from a good tutorial and wanted to put it up here so it would get in some search results. it took me about 2 days to find it. also i added a few custom functions to it.. ...
2
votes
1answer
87 views

Could really use some feedback on this registration code in php

I was hoping someone could give me some feedback on my code. I am still new to php and I'm sure I have messed up somewhere. The code pasted is for a registration page where users will submit their ...
-1
votes
1answer
56 views

Optimisation for random generator code in PHP [closed]

I'm really confused about combining MySQL queries and please could you lend me a hand? Please explain in simple English. The code is: $result1 = mysql_fetch_assoc(mysql_query("SELECT COUNT( * ) ...
2
votes
1answer
93 views

How secure is this PDO Portfolio Script?

I was wondering if someone could take some time to look over my portfolio script and see let me know if it's secure enough to be uploaded live and connected to my database. My previous mySQL script ...
0
votes
1answer
59 views

Cleaner more efficient way of multiple database queries

I have the code below I probably did not need to post the entirety of it but you can see in the code that I make multiple data base queries to generate each of the multiple tables. I am curious if ...
1
vote
1answer
507 views

Is this PHP class good enough for CRUD

I wrote this class to make it reusable in any project. It uses PDO as the MySQL connection. Beside not using Setters and Getters, is this code secure and good practice for CRUD ? Thanks for further ...
0
votes
2answers
128 views

Create loop to shorten this code up

I am new to programming as you can probably tell from the code below I am curious if there is a way to create a loop so I don't have so many copy's of the same code with only different variable names. ...

1 2 3 4 5