Questions tagged [mysql]

MySQL is an open-source, relational database management system. If your PHP code uses MySQLi, use the MySQLi tag instead.

Filter by
Sorted by
Tagged with
7
votes
1answer
265 views

What is better for the code segment, sockets or multiple processes?

I am trying to fetch information out of SHOUTcast for mutiple users at the same time. Here is my current code: ...
2
votes
1answer
855 views

OOP MySQL connection class

Under sage from another CR post I'm crafting an OOP MySQL connection/query class. Nothing new, but a place to start plying OOP PHP. Here is the current design,what would aid speed and portability? ...
3
votes
1answer
244 views

Song database query

I am relatively inexperienced with MySQL and have a query, which to my eyes appears relatively complex: ...
2
votes
1answer
101 views

MySQL query: blog entry has comments or not

How expensive is this query? Lets say for example if I don't have a field called total_comments in my blog table. All I want to ...
4
votes
6answers
11k views

PHP login cookie authentication

I have the following code to do remember-me style login: ...
3
votes
0answers
101 views

Keeping track of voting

There is HTML that triggers the code below I want to disallow executing the script more than once per 24 hours. I wanted this script to store the last visit time in a table against the user ID in a ...
5
votes
2answers
154 views

Finding database matches and storing them in a glycopeptide structure

I am relatively new to C and would like some feedback on a function that I have written, if it adheres to C standards or if there are some other things which I could have done better/differently. <...
3
votes
1answer
102 views

Creating a table for use in Excel

I'm looking for some assistance with a PHP script I'm writing. It creates a table that is then exported to an Excel file for download. The issues as I see them are as follows: ...
2
votes
1answer
828 views

Comparing products sold by several merchants

My application is for the use of comparing a product sold by several merchants on a daily basis. A process runs to load the current values of data for each store and enters it into a database along ...
5
votes
6answers
900 views

40 million tweets from 200k users

...
2
votes
1answer
307 views

Newsletter SQL query optimization

I want to build a small newsletter like tool which sends mails in pre-defined timespans. First after registration, second 14 days later, third 7 days later etc. I came across for two database designs ...
5
votes
1answer
270 views

SQL - How's my formatting?

I'm somewhat new to SQL (using it in the past but only being exposed to it heavily in my current role). Unfortunately nobody at my current company has really given me any advice on formatting. How can ...
3
votes
2answers
670 views

Phrases update query

My query is this: UPDATE `phrases` SET `phrases`.`count`=(SELECT COUNT(*) FROM `strings` WHERE `string` LIKE CONCAT('%', `phrases`.`phrase`, '%')) My tables look ...
3
votes
1answer
1k views

Nested while loop for getting db data. Timing out at random times because of the PHP. Any way to make this more efficient?

So today I jumbled together a script that would get data from a database, from different tables and such. I had wanted to just use simple ifs without the whiles, but I couldn't make it possible. The ...
2
votes
2answers
180 views

Detecting if a CAPTCHA is needed

I wish to ask if the code written below has any holes (probably it will be useful for someone else). This code checks, by IP and by userid, if more than 5 attempts ...
1
vote
1answer
88 views

is there a better and short way to getting that array from joined sql query and converting it to superfish dropdown menu?

I'm trying to build a superfish dropdown menu from a sql query. Working example is can be seen from here check the "emlak bul" category: http://www.bedavaemlaksitesi.com/mersinemlakrehberi210/sayfalar/...
5
votes
2answers
4k views

Using a subquery to rename columns

This is a pattern in SQL queries that I've found myself repeating recently: ...
1
vote
1answer
676 views

Database accessor functions

I've been away from PHP for at least 5 years and I'm just starting to look into it again. I have a set of functions I created and used for database access and I'm wondering if they are still good to ...
1
vote
1answer
213 views

PHP MYSQL loop to check if LicenseID Values are contained in mysql DB

I have some troubles to find the right loop to check if some values are contained in mysql DB. I'm making a software and I want to add license ID. Each user has x keys to use. Now when the user ...
1
vote
1answer
151 views

<select> has extra blank <option>'s and I have no idea why. please help me get them out [closed]

This is the result of the code it has extra option tags no idea why. I have no idea why It produces the extra option box. Below is the result of the query. Correct number of rows correct response......
5
votes
2answers
20k views

MySQL database connection in the constructor

I'm an absolute beginner in PHP OOP in search of the "Holy Grail" of connecting to MySQL database once and reusing this connection for the whole site. classes/db.php ...
4
votes
2answers
4k views

PDO (MySQL) connection and query class, safety and logic

For the last few day I tried to figure out how to work with MySQL and PDO. Although I've tried to read a lot about the subject, there are still a lot of things I don't understand. Because of this ...
5
votes
4answers
2k views

Database schema for Service Order Management project

I'm a student and I've created this MySQL database schema for my Service Order Management academic project. I want to know if I need to improve it and, if so, how I could do that. ...
2
votes
1answer
679 views

MySQL PDO class

Please give me any comment about these codes. Does it enough to prevent SQL injection? What I have to do to make the code better? ...
1
vote
2answers
4k views

Php INSERT class function

This is a INSERT function. It's working... I just pulled out the function from the class, atm to try it out. And improve. I think the code is a bit messy, And I am pretty sure I can improve the code, ...
1
vote
2answers
267 views

Class for sending emails

I'm 100% sure improvements can be made. Any help is greatly appreciated. I should add that I am new to OOP and am not sure if I'm using this the right way. ...
1
vote
1answer
253 views

Acquiring product details

I have these MySQL tables: ...
2
votes
1answer
433 views

Simultaneously searching listings by attributes such as category, title, postcode

Is the code below safe from SQL injection? ...
2
votes
1answer
303 views

SQL Injection and php performance checking

I hope this is not a really bad question for a first time here beginner. This piece of code selects from the left table and will list the content in the right hand table. This is a working code but I ...
0
votes
2answers
166 views

Make two MySQL statements & loop quicker

Would a join be quicker here? I tested a join and it's almost the same time! Basically its a ray casting mechanism that finds all properties in a square on GMaps, and then there's a javascript ...
1
vote
2answers
259 views

Creating SQL queries for a MySQL database

I am writing a PHP application that works with a MySQL database. As I am fairly new to PHP I am looking for ways to improve my code. Below are two functions, ...
3
votes
2answers
980 views

Inserting an entire form into MySQL database

Please review this. ...
2
votes
1answer
116 views

Wordpress $wpdb->row Query Check

Looking at $wpdb class, I found get_row, and I am unsure if the function automatically prepares the query. I believe it does not ...
6
votes
2answers
4k views

PDO wrapper class

...
6
votes
2answers
23k views

Read from SQL database table, store in list of objects

...
0
votes
1answer
10k views

How can I display the results of mysql_fetch_assoc in a dynamic table?

I have a MySQL database with several columns and two rows of data, so far. I'm using mysql_fetch_assoc to return the data in database, but I don't know how to put it all together in a table so that I ...
1
vote
3answers
359 views

How could I make this PHP $_POST more secure? -Or is it secure already?

On most my $_post data inputted on my site I use the following php: ...
2
votes
2answers
1k views

Function to store data in MySQL database (using OurSQL)

I am parsing a huge XML file. It contains some million article entries like this one: ...
2
votes
1answer
219 views

Query of top players of the month

In a web game there is a ranking of the top points games played of the month: ...
1
vote
1answer
165 views

PHP email selector class

I've only been writing php for a couple of months, and I've never really had anyone to look at any code I have written. I've written this class, that returns an email address from a database, based ...
2
votes
1answer
4k views

Login and signup validation php critique

Please critique my login and signup validation php files.. login.php; ...
1
vote
1answer
1k views

Cash Register database structure

I would like your thoughts on my database structure. I am kind of a rookie but I am trying. All of your suggestions, alternatives, ideas, additions are welcome. Thank you. ...
3
votes
2answers
408 views

PHP simple engine

i have created simple php engine, i want that this engine used html/php codes from mysql. Here is this php code and please if you find out some mistakes or bugs, please post here. I realy want to use ...
2
votes
2answers
220 views

Sanitisation function: any holes?

I've come up with this small function to make user submitted strings safe for MySQL. I'd be grateful if someone could point out any security holes in this. I've tested it out, and it happily replaces ...
2
votes
1answer
879 views

Polling script to determine the continuous time a user has been connected

I've been asked to keep track of how long a user has been connected to a site without interruption. So far the solution I've come up with is to use ajax to poll the site every now and then to check ...
6
votes
2answers
823 views

Querying MySQL from an external application

I have a database that I need to query over and over as fast as possible. My queries execute pretty quickly, but there seems to be some additional lag. I have a feeling that this lag is due to the ...
2
votes
1answer
478 views

MySQLi_STMT wrapper, allows placeholders

I've made a simple wrapper for MySQLi_STMT, allowing the usage of placeholders and spares you the need to manually bind variables. The full code is at the bottom of ...
3
votes
1answer
209 views

Maintaining a column for each datatype

I have a function that is suppose to store variables based on their datatype, and this is table I have come up with to store those variables into. Is it smarter to have everything broken down like ...
4
votes
2answers
2k views

How can I improve this PHP MySql Rank generation function?

How can I improve this PHP MySql Rank generation function? (Mostly looking to improve speed, but any feedback is very welcome) Right now I keep stats and ranks in 2 separate tables. The only ...
6
votes
2answers
427 views

Working with databases in PHP

I am 100% self-taught, and so I try to read as much as I can about best practices, conventions, etc. However I freelance, and have been in a long-term contract position for the past little while with ...