mysql

my_thread_global_end threads didn't exit, error?

I am using MySQL c++ connector (1.0.5) , recently I moved get_driver_instance() and connect() methods to secondary thread then I am getting below error. Error in my_thread_global_end(): 1 threads didn't exit After googling I found that mysql thread isn't exiting. Is there a method in c++ wrapper to do cleanup? ...

PHP & Mysql database updating problem

For some reason when I changed my php code from mysql to mysqli everything got messed up. For example, when a user enters a rating my mysql table updates twice by entering one new row and updating the correct row. I was wondering how do I correct this problem so it only updates the new row and checks to see if there is no row it enters ...

Need some input on MySQL schema

I need some inputs on how I should structure my db. Let's say I want to store members data in members table. There are two types of members, let's say person and organization. Person and organization have different set of information so that we have to store them into two different tables: let's say persons and organizations. I would h...

Is it beneficial to split huge MySQL database into several databases to increase performance?

There is a substantial MySQL database with data weighting hundreds of gigabytes. It experiences performance problems. Vertical and horizontal partitioning of tables are possible roads to increase performance. In your opinion would splitting this database into several databases be beneficial to increase performance as well? The project ...

how to use use load_file in mysql ? I get a wrong message " Can't get stat of 'D:\w.ini' " !

like the title. I guess it is the matter of file's name. But I try "D://w.init" and "file:///D:\w.ini", I util get this wrong message. ...

Select date range using SQL

Hi everyone, I'm trying to select a date range using SQL and I've come across a few issues: When I run something along the lines of: SELECT ... as edate ... WHERE edate BETWEEN To_Date('10/15/2010', 'MM/DD/YYYY') AND To_Date('10/15/2011', 'MM/DD/YYYY') it will come back with a ORA-01848: not a valid month . The tab...

Login suggestion query

I want to suggest login to user if their first choice was already taken. Suppose, user want to register as "Superman". There is already some Supermans on site. Logins are suggested in form "Superman01", "Superman02" and so on. So, script must: check for 'Superman' login in db if already used, append '01' to login and check for it in DB...

SQL Query Producing No Results

Hello, I am trying to make this query work: SELECT Stock.*, StockFeatures.Features, StockDescriptions.Detailed, StockDescriptions.Technical, PRD1.RuleValue as Price, PRD2.RuleValue as WasPrice, PRD2.RuleValue-PRD1.RuleValue as Save, PRD1.Quantity FROM StockFeatures, Stock INNER JOI...

How do I use "group by" with three columns of data?

My query currently is: SELECT x, MAX(z) AS mz, y FROM my_table GROUP BY x The columns x and mz are returned as expected, but the last column, y, does not match up with the other two. In other words, I want the "y" column to match the mz column just like the x column currently does. How do I pull that off? UPDATE: Sorry, the question ...

Create user and privileges to DB in MySQL VIA script

I need to create a script that can create a user/password and grant then certain privileges on a local DB. Thanks in advance! -Sol ...

MySQL 3 tables in one query?

Hey guys, I'm trying to create a efficient query which will retrieve 'projects' from a database and all the relevant 'tags' which have been assigned to that particular project. My table setup mimics that of wordpress, and is a tad complicated: term - Where I define the tags name, slug etc term_relationships - Links the project to a t...

How to make my server work with an iPhone app?

I am working on a social network project in PHP/MySQL. If you have ever seen or used the myspace or facebook iPhone app you will see what my question is all about. I am curious what most iphone apps do with the server for a social network type iphone app. I was tyhinking possibly it uses a REST server with jSON or XML output and possi...

problem with '-' and '&' string in mysql

I have a search engine in PHP. When a search normally it's OK. Search text is 'company', and in the database there is 'company' in the field... The problem is when the search text is &company or -company and the data is &company or -company there is no match. why? problem with the - and & string... ...

JSON to PHP, then foreach?

I send a valid JSON string to my PHP page from jQueryscript: var data = '{ "data":[ { "id":"12", "checked":"true" },{ "id":"4", "checked":"false" },{ "id":"33", "checked":"false" } ] }'; $.post ("page.php", { data_input:data }, function (data) { // code }); Once I get the data in my PHP page, I parse it ...

MySQL install script

is there a way to automate to install MySQL without having to use the wizard to specify root password, etc. Basically, I need to install MySQL as simple as possible for the end user. Thanks ...

Multiple MYSQL queries vs. Multiple php foreach loops

Database structure: id galleryId type file_name description 1 `artists_2010-01-15_7c1ec` `image` `band602.jpg` `Red Umbrella Promo` 2 `artists_2010-01-15_7c1ec` `image` `nov7.jpg` `CD Release Party` 3 `artists_2010-01-15_7c1ec` `video` `band.flv` `Presskit` I'm going to pull images ou...

Get Roles which are still not assigned to member query

How would I query MySQL database to return roles that are still not assigned (like available to him). With table user_roles: |user_id|role_id| | 1 | 1 | | 1 | 2 | | 1 | 4 | | 1 | 7 | How can I query roles table to return role name and id of all the roles that are not assigned. role_id: 3,5,8,... ...

How can I store PHP code inside of a mysql table

I am working on building a small php/mysql script that will act something like a wordpress blog but will just be a small site for my eyes only to store PHP code snippets. So I will have categories and then pages with sample code that I write with a javascript syntax highlighter. Instead of storing my php code snippets in the file I am ...

Concatenate JOINS or write recursive function - problem with dynamic number of JOIN queries

I have the following problem to solve: Let's say there is a table A that contains an number of elements, this table is copied to become table B. In table B some of the original elements are lost and some are added. A reference table AB keeps track of these changes. Then table B is copied to be table C and again some of the existing elem...

When to add index on joined tables

I have a mysql table with 9 million records that doesn't have any indices set. I need to join this to another table based on a common ID. I'm going to add an index to this ID, but I also have other fields in the select and where clause. Should I add an index to all of the fields in the where clause? What about the fields in the s...