mysql

MySQL and faceted navigation (filter by attributes)

Hi, I feel like this question has probably been asked a thousand times already, so I apologize if it's been answered. And if so, can someone point me to the right posts/links? What I'm trying to do is build a faceted navigation for my site. It uses MySQL and here's a rough sketch of the tables I'm using: products: - id - title - descr...

Mysql Memory/Heap table data retention/loss/purge

Hi, I have multiple tables created in MySQL Memory Engine. Except for 3 tables, all other tables will be updated daily (all the records). We recently noticed that data in one/more of these tables is being deleted after around 14 days (with No data modification statements executed). The data is not completely truncated in a table. Som...

selecting rows that are older than current date in mysql

I have a mysql table with fields for a start and end date/time. How would i select just the rows that are older than the current date using php. The format of the end-date is 2009-11-25 08:01:00 and the field type is datetime ...

count top 10 most occuring values in a colum in mysql

I have a colum in mysql table that is INT(11). How can i search to get the 10 most occurring values in this column? ...

Questions on Auction Database Schema

I was looking at the following db model and I had some questions on it. I'm sure it's a good design as the guy behind it seems to be reasonably well qualified, although some things don't make sense: Why's he seperated out bidders and sellers? I thought you'd have users, and users can place bids and sell items. You'd have a bids table w...

Secure(r) storage of MySQL login information?

First off, I realize that there is no such thing as a perfectly secure solution (and even if there were, its usability would be crap). That said, how do you protect your MySQL database from being compromised by someone downloading your code and picking through it? Based on my experience with PHP, it seems obligatory to store it within ...

getting same property from mysql with php

suppose i have 1 current user id and another user id to which current user is visiting.....than i want to fetch mysql data only if both have same options..... for example user1 has uploaded a picture and user2 has also uploaded picture.......than how can i matchd user1 to user2 and query should be like this........ select * from users ...

JOINT MySQL Query

If i have tables such as: table_1: 1, 'Hello My Name is Hal', '2009:11:02 08:42' table_1: 2, 'Hello My Name is Dave', '2009:11:02 08:30' table_2: 1, 'Ima all #red due to twitter', '2009:11:02 09:42' And lets imagine all the table columns have the same col_names Is there any way i can do a query to return the results in one SELECT on ...

Subquery to String?

Hi all, I have a table containing countries: id country ------------ 0 Monaco 1 Mongolia 2 Montenegro 3 Morocco 4 Mozambique 5 Myanmar I have a sub query that looks like this. (SELECT country FROM COUNTRIES WHERE id < 10) AS ´Trip´ I want to have that subquery to be formatted as a string like this: '...

How I can optimize this slow query?

I want to know how I can optimize it, preferably without changes in tables structure. SELECT p.author_id member_id, m.members_display_name member_name, COUNT(p.pid) posts FROM forum_topics t STRAIGHT_JOIN forum_posts p STRAIGHT_JOIN forum_members m WHERE p.author_id != 0 AND p.author_id = m.member_id ...

please check validation

Hi frnds,i am inserting day value to database,i want validation like if the day already exist it should say day already exist else it should innsert..please can anyone check the following code... thaanks in advance $dexist=$_POST['ext']; $res=mysql_query("select Day from mess where Day='".$dexist."' "); while($row=mysql_fetch_array($res...

getting user activity

suppose i have two tables 1. messages 2. friends than how can i get the activity of users from friends table and show it to current active user if 2nd or other user is in his friends list..........order by id just like facebook newsfeed ...

Why _mysql.co that compiled on one Mac doesn't work on another?

Hi guys, I want to use Python-MySQLDB library on Mac so I have compiled the source code to get the _mysql.so under Mac10.5 with my Intel iMac (i386) This _mysql.co works in 2 of my iMacs and another Macbook. But that's it, it doesn't work in any other Macs. Does this mean some machine specific info got compiled into the file? ...

Getting data from the database with python(on Django framework)

Hello, ordinarily if I were writing a sql statement to this I would do something like this, SELECT * FROM (django_baseaccount LEFT JOIN django_account ON django_baseaccount.user_id = django_account.baseaccount_ptr_id) LEFT JOIN django_address ON django_account.baseaccount_ptr_id = django_address.user_id;name how do I put this into...

getting multiple tables data with php

Suppose i have two tables... I want to get two tables data order by date posted/added or order by id! so that if i have table1 id msg date 2 this is msg nowdate table2 id comment date 2 this is comment nowdate Then how can i get it in single query order by id? ...

latin-1 to utf-8 data porting

i have an old site whose database is in latin-1 encoding. i have created a drupal site duplicate of old site By default drupal database is in utf-8 encoding now how do i port the database from latin-1 to utf-8 . i tried myself and i get unwanted charachters . how should i do it. ...

Xcode gcc exit status 1

first of all i am very new to all this. i recently upgraded to Snow Leopard and installed the Xcode + iPhone dev package, 3.1.2. I went on to install the Django framework + MYSQLDB handler. During the build stage, the terminal shows me the gcc exit status 1 error. But I have the Xcode already installed? where am I going wrong? Also whi...

creating trigger across different databases

Hi, Is there any way to create triggers on different databases? my requirement is like:- database: a1.db consist table: t1 database:a2.db consist table: t2 now i have to use trigger on t1 (whenever any delete and update operation) happens on t1 a value has to be inserted into t2. waiting for your feedback... ...

Mysql Query doubt

I have three tables namely test1, test2, test3 test1 data =========== id test_id q_id 1 25 2 2 27 2 test2 data =========== id test_id q_id 1 25 2 2 34 2 test3 data =========== id test_id q_id 1 34 2 how get test_id value with q_id = 2 from these three tables without repeating data ? that ...

How to order 1,2,3 not 1, 10, 11, 12 in mySQL

The following code outputs in order of 1, 10, 11, 12 of id. I want to make it 1,2,3,4... Could anyone tell me what I should do please. $Q = $this->db->query('SELECT P.*, C.Name AS CatName FROM products AS P LEFT JOIN categories C ON C.id = P.category_id'); Thanks in advance. ...