mysql

how to make sure other programmers don't put backdoors and callbacks in my site!

How can I look for any client side call backs in javascript. I have people adding javascript code for me. how do I make sure they are not somehow sending confidential data or user info to their sites through client side POST, GET, AJAX or any client side methods! How would I do the same thing for my server side code like to see my php p...

Mysql unique index does't work on a certain umlaut

I have a users table in which there's a column called 'nickname', utf-8 encoded, varchar(20), the table is in InnoDB. There're 2 records one has a nickname = 'gunni' and the other nickname = 'günni'. When I tried to apply a unique index onto this column, mysql gave me this error : ERROR 1062 (23000) at line 263: Duplicate entry 'gun...

Mysql select data using multiple conditions

Hi, I have a table like id fid 20 53 23 53 53 53 Here I need to return true when my condition is something like .. where fid=53 and id in(20,23,53) and also I need to return false when....where fid=53 and id in(20,24,53). But the above condition not satisfy my requirement.Both queries returns same value(true).Please help me...

How to apply privacy settings on posts the appear in a news feed with MySQL ?

What I am trying to achieve is a complex privacy routine, i have the following tables. posts posts_privacy privacy_global followerlist We have a news feed sort of thing on our site, which gets the 10 latests posts from the people a user is following, there are 3 levels of privacy, first is privacy_global where the user can set a pri...

[Select multiple field subquery] as a field in a [mysql select query] to get set of array data

How to fix this mysql query SELECT no, name, (SELECT chapter, max FROM table2 WHERE name = user.name AND max = 10) as sub_array1, (SELECT chapter, max FROM table2 WHERE name = user.name AND max = 20) as sub_array2 FROM user ORDER by exp DESC example expected out result: the current query returns me Operand should contain 1 column(s) ...

SQL retrieve yearly repeated event

How to write a sql statement to retrieve repeated yearly event, which mean retrieve all the event regardless year only match with month and date. Select * from Event where [date] = date ? ...

how to backup all DB info using mysqldump?

I want not only the "Create table" statements, but also the Inserts. What flags should i pass to mysqldump? In addition - the database is relatively large (2-2.5G). Obviously, i want the backup to be as fast as possible. Any flags that might help? Thanks ...

Data Partition in C#

I want to distribute a large amount of data to different C# applications. For example, my table contains millions of records. I would like to specify that first 3 millions records are processed by App1 and next 3 million in another C# application App2 and so on. Table rows are deleted and added as per requirement. Now I want to write a S...

delete main row and all children mysql and php

Hi there, I have inherited a PHP project and the client is wanting to add some functionality to their CMS, basically the CMS allows them to create some news, all the news starts with the same content, and that is saved in one table, the actually news headline and articles are saved in another table, and the images for the news are save...

Echo each Catagory from a table into its own DIV

Hey, My problem seems complex to me, but im sure theres a simple way to do this. Essentially, I have a treatments list. On the MYSQL table the list's items are broken up by catagory, title, description and price. I need to echo out each catagory into a div each, sectioning them off. So, if the user has 4 catagories of items then I sho...

with index, returns different result.

Never seen this before. Running the same query, 1 forces an index. Without the index, the results are incorrect (in wrong order), with the index the results are in the correct order. Only problem with using the index is that its slower for some reason. Index is on comment_id and user_id without index: SELECT DISTINCT topic_id FROM comm...

Lost connection to MySQL server in Windows XP while adding Data Source - ODBC

Hi, When I am trying to connect to the localhost, there is no problem. But when I am connecting to my server, I am getting this error. [08S01][MySQL][ODBC 5.1 Driver] Lost connection to MySQL server at ‘reading initial communication packet’, system error: 2 Please tell me how to work around this. I have tried with MySQL ODBC Drivers, b...

how to create a file of mysql database schema?

I need some help about how to dump only database schema, not the data. Our database already has data.But i want to create a database dump only for schema with out data. I think mysqldump dumps schema along with data. Are there any options i can specify which will let me to dump schema without data. ...

Mysql rank function

Hi, I am not an expert in mysql.I need to find out rank of customers.Here I am adding the corresponding sql query for my requirement.Please help me to convert it to mysql. SELECT RANK() OVER (PARTITION BY Gender ORDER BY Age) AS [Partition by Gender], FirstName, Age, Gender FROM Person .Is there any function to find out ra...

Search for products with multiple criteria

I'm having a problem with fetching some data. The tables I have (for testing purposes): Products: product_id | product_name ----------------------------- 1 | product 1 2 | product 2 3 | product 3 Attributes: product_id | attribute_id | attribute_value -----------------------...

Cannot delete or update a parent row: a foreign key constraint fails

I get this error message: ERROR 1217 (23000) at line 40: Cannot delete or update a parent row: a foreign key constraint fails ... when I try to drop a table: DROP TABLE IF EXISTS `area`; ... defined like this: CREATE TABLE `area` ( `area_id` char(3) COLLATE utf8_spanish_ci NOT NULL, `nombre_area` varchar(30) COLLATE utf...

JSON or XML or serialized array to save in MySQL database

Web app. Get data from services in json & xml formats. And from internal module in hash. Decided to choose one format for all stored data. details : More read than write. Data low nested (< 10). Char count between 1000 - 100000. Programming language - ruby. Framework rails. DB mysql. What's your recommendation? ...

How do I to keep the values of a column unique in MySQL?

I do file parsing in Perl and insert into a table in a MySQL database. For example, I have the following fields: S.No ,PCID,USERNAME, TIME INFORMATION. 1 203 JANE 22:08 updation 2 203 JANE 22:09 deletion 3 203 JANE 22:10 insertion In this table I wanted to have the PCID to be unique, USERNAME to be u...

How to fill a column based on first column

I am making a mySQL table which lists ~70 products and information on whether they are compatible or not. For the sake of simplifying the question, I will pretend there were only four products. Product1 Product2 Compatible? A A Yes A B No A C Maybe A D ...

hibernate locked table

Why is this giving me a lock timeout: for(int i = 0; i < playersCount ; i++) { StatUser stats = (StatUser) selectedUsers.get(i).getStatUsers().iterator().next(); int gc = stats.getGamesPlayed(); int gm = stats.getMakeCount(); Session session = HibernateUtil.getSessionFactory().getCurrentS...