mysql

MySQL Fulltext search phrases

How to use mysql fulltext search to search for phrases instead of like : SELECT description FROM t WHERE info LIKE "%Search phrase one%" OR info LIKE "%Phrase second%" OR info LIKE "%Another phrase with more words%" ...

DB for Commenting System

i wanna create a 2 level status message system. Which is the best way to create a tables ? Scope: User sets a Status Message Users Reply to the status message this is a picture showing it Tables i have created users (id, name .... ) status_messages (id, message, time, user_id) status_message_replies (id, message, time, status_me...

How to insert values into an MYSQL-Table by using Select-Statements

Okay, This one is pretty simmilar to my last one, but I don't get it...! I am trying the following: Insert into table b (Select column_1 from table_a where ID = 1), (Select column_2 from table_a where ID = 1), 0, (Select column_3 from table_a where ID = 1); But I always get a syntax-error...! I think it's quite logical what I...

MySQL procedure to load data from staging table to other tables. Need to split up multivalue field in the process.

I'm trying to export data from a multivalue database (Unidata) into MySQL. Lets say my source data was a person's ID number, their first name and all the states they've lived in. The states field is a multi value field and I'm exporting them so that the different values within that field are seperated by a ~. A sample extract looks like:...

Cakephp model associastion

I have thee following simple model: Item belongsTo CatalogItem CatalogItem hasMany Item, and belongsTo Section Section hasMany CatalogItem I'm trying to get counts of items, grouped by catalogitem, for a certain section- the equivalent of: SELECT catalogitem.id, count(*) FROM section LEFT JOIN catalogitem ON section.id=catalogitem.sec...

mySQL "friends in common" query

Im trying to get a set of "Friends-in-Common" via the friends table: And then I would like to select * from the users table WHERE userId is in the friends in common set. friends .id...dom...sub .1.....2.....1 .2.....1.....3 .3.....1.....4 .4.....1.....5 .5.....2.....4 .6.....2.....6 .7.....3.....2 .8.....3.....6 .9.....2.....3 use...

Mysql granting provileges on all databases, except a few

I have a dev MySQL server, on which there are many databases, and most of them change constantly... I need to grant full access to all databases to a particular user, and only read access to 2 of those databases (these are replicated from another server). I don't want to explicitly grant full privileges on every database, as the list c...

MySQL keeps restarting

Here is the error log: 100825 10:44:25 [ERROR] /usr/sbin/mysqld: Table './kaiaxco_cdb228/c_campaign_data' is marked as crashed and should be repaired 100825 10:44:25 [ERROR] /usr/sbin/mysqld: Table './kaiaxco_cdb228/c_campaign_data' is marked as crashed and should be repaired 100825 10:44:51 [ERROR] /usr/sbin/mysqld: Table './kaiaxco_cd...

Array, EAV, Serialized LOB for custom fields?

I've been trying to answer a complex Mysql data structure problem for custom fields for an online app. I'm fairly new to Mysql so any input is appreciated. The current database is a relational database and each user of the service will share the same database and tables. Here is an example of what I'm trying to do. Let's say I'm tryi...

MySQL Field and Table Name Conventions

Are there any naming conventions for tables/fields within MySQL. I have found a big list of "reserved words" but other than that are there any other concerns about naming? For example, are field/table names like this acceptable: p_name p.name p-name Please advise. TIA. ...

Unknown column 'time_submit109' in 'field list'

I'm using the PHP script below for an experiment I am conducting, however it seems to error out with the error message: "Unknown column 'time_submit109' in 'field list'" when it gets to the digit span task (around page 110). How do I resolve this error (I'm not well versed in PHP so I'm having a hard time debugging this). I think the err...

Forming SQL Query for Detail and Subtotals (MySQL)

I have a common SQL task but can't find a clear path to the solution. I have a table, downloads with the columns, download_date, image_file_id, credits. What I want at the end is the detail, plus a subtotal of credits for the day at the end of each day. E.g. 2010-10-06 123456 5 2010-10-06 234567 20 25 2010-10-07 234678...

Update TableA with values from TableB?

If I have 2 tables, each have a product_stat DECIMAL and product_id INT column I want to run a query that will append the product_stat from TableA to TableB on product_id. Then truncate TableA Basically I am collecting data and temporarily storing it in TableA, and once a day I want to move the data to TableB. So that TableB only has t...

php refactoring and better coding for php?

i have this process that is the heart of my app, that im creating, but for some reason i feel like its the worst way to do it(instinct) , and i wanted to see if thier is something wrong with this process, and am i approaching it in a bad way! p.s. the code works fine, just refactoring problem. the process is: users go to homepage, they...

simple cms with content construcion and multilingual capabilities

... and also using PHP MySQL combination. ...

How to configure nagios with mysql

HELLO! I have installed nagios 3.2.2 and I am trying to configure it with mysql, but I cannot find the file "create_mysql", this file should have the necessary tables for. Ah! It is over debian lenny. Where is it supposed to be located? Thanks. ...

Database design for dynamic form field validation

In my application, I allow users to create a form containing any HTML form field they want (e.g. text input, textarea, select, etc.). I want to give the users the ability to define 0 or more cumulative validation rules for each field (there might be up to 25 different validation rules). How should I model this? Here's a potential soluti...

Is it better to return one big query or a few smaller ones?

I'm using MySQL to store video game data. I have tables for titles, platforms, tags, badges, reviews, developers, publishers, etc... When someone is viewing a game, is it best to have have one query that returns all the data associated with a game, or is it better to use several queries? Intuitively, since we have reviews, it seems poin...

MySQL-bin.XXX taking up extreme amounts of space in logs

We have recently deployed a Drupal 6 install and the directory storing the mysqld-bin.XXX files /var/run/mysqld has caused the mysql server to crash. The size of these files (log) are over 1g in size each and there are tons of them. I would like to know a way we can either enable log rotation or something similar to insure this does no...

Compiling PHP4.4 with MySQL 5 support.

I'm trying to support a rickety old system until the new intranet is built. The previous programmer somehow got PHP4 and MySQL 5 to work together by doing option 1 and I need to do the same to make a dev environment so I can stop messing directly with the live server. I currently have a test server running PHP4 and I can't connect to my...