mysql

One to many mySQL database setup

I'm having trouble wrapping my head around how to set this up. I have two tables: Projects Sections 1 project can belong to many sections. 1 section can have many projects. How would I go about setting this up, would this be a many to many relationship or one to many? Would it best if I created a lookup table? ...

SELECT from two same table with intersect

The query: SELECT id_user FROM Rating Where id_movie=2 INTERSECT SELECT id_user FROM Rating Where id_movie=3 but I get: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTERSECT SELECT id_user FROM Rating Where id_movie=3 LIMI...

Aggregating data by timespan in MySQL

Basically I want is to aggregate some values in a table according to a timespan. What I do is, I take snapshots of a system every 15 minutes and I want to be able to draw some graph over a long period. Since the graphs get really confusing if too many points are shown (besides getting really slow to render) I want to reduce the number o...

Using MySQL and database and having ClassNotFoundException

I have these two classes in my database package:(DBManager and TaskManager class) and I create a new object in my main frame which is in the other package and I also imported the database package for my main frame and I call addBirth() on my object,and I want to insert these arguments in my table="birthsql" in MySQL but I found this exce...

#1130 - Host ‘localhost’ is not allowed to connect to this MySQL server

I issued a command of: DROP USER 'root'@'localhost'; GRANT ALL PRIVILEGES ON . TO 'root'@'%'; ...in PhpMyAdmin. Immediately after the execution, I was forced out PhpMyAdmin. I got: error #1130 - Host 'localhost' is not allowed to connect to this MySQL server, how to resolve my problem? ...

Percentages in MySQL

Using this query, SELECT company, YEAR( date ) as year, COUNT( * ) as total FROM table WHERE company = "Medtronic" OR company = "Private" GROUP BY YEAR( date ) I get a table like this: Company year total Medtronic 1998 6 Private 1998 5 Medtronic 1999 5 Private 1999 1 How do I calculate the % that is cont...

One Table Or Three For Three Separate Objects That Have Identical Data Attributes?

I am building a site for a magazine that includes three different sections- articles, blog posts, and reviews. All three of these object types have the following columns in common: title, description, headline, subheadline, body, and author. Should I store them each in their own table, or should I just create one Posts table and add a ca...

I cannot convert myISAM to innodb.

I did a wipe and restore. I backedup my current innodb tables. (mysqldump) I loaded it into the database. For some reason...the tables are now all myisam instead of innodb...weird! I try to do: ALTER TABLE xxx ENGINE=innodb; And it doesn't do anything to any table. "Show table status" still is "MyISAM" mysql> alter table auth_use...

PHP 'smart' search engine to search Mysql tables advice

I am creating a search engine for my php based website. I need to search a mysql table. Thing is, the search engine must be pretty 'smart', so that users can easily find their items (it's a classifieds website). I have currently set up a FULLTEXT search with this piece of code: MATCH (headline) AGAINST ($querystring) But this is...

php redirection

My php script is working on localhost but after uploading online it's showing a blank page. php installed on localhost version 5.2.6 php installed on production environment version 5.1.4 <?php define('INCLUDE_CHECK',true); require 'connect.php'; session_start(); php require 'function.php'; ?> <html> <head> </head> <body...

will the sql queries i run in ms-access also work on mysql without any changes ?

will the sql queries i run in ms-access also work on mysql without any changes ? ...

MySQL - convert and compare dates on query

I'm working on a football site witch, along with many features, list result tables. The tables are separated between seasons (season name, etc) and rounds (witch are generated everytime a new season starts up, like 2008/2009, 2009/2010, etc) rounds table has a start date and a end date, and the only way I have to dinamically know wich r...

MySQL Join from multiple options to select one value

I am putting together a nice little database for adding values to options, all these are setup through a map (Has and Belongs to Many) table, because many options are pointing to a single value. So I am trying to specify 3 option.ids and a single id in a value table - four integers to point to a single value. Three tables. And I am runn...

making a php function that If mysql returns 0 rows, return false

Im trying to get the function below to return TRUE if it finds a matching row, and FALSE if it finds 0 rows. function IsOpenEvent($id) { $result = mysql_query("SELECT * FROM `events` WHERE `access` = 'public' AND `id` = '$id' LIMIT 1") ...

how to import excel 2007 file containing 0.4 million records into mysql table.

how to import excel 2007 file containing 0.4 million records into mysql table ? please suggest appreciate any help ...

Using MySQL and database and having this stacktrace

I have these two classes in my database package:(DBManager and TaskManager class) and I create a new object in my main frame which is in the other package and I also imported the database package for my main frame and I call addBirth() on my object,and I want to insert these arguments in my table="birthsql" in MySQL but I found this stac...

Creating an efficient way of keep track of many 100's of 1000's of tagged cache id references

We currently have a table setup to keep track of cache file names or memcached key references. The table exists so that when a comment is added or more content is added the system automatically purges those cache files/key-value pairs that are affected by the update so the rebuild the next time a user accesses the page the user sees the ...

advanced sql query help

i have a table with products and the user can choose which regions and cities he wants to let them be visible to. he can choose ALL REGIONS and ALL CITIES from a drop down menu and then i will put in the columns = 0. the the buyers can choose which city they want to watch products from so they aslo have a drop down menu to pick a region...

Good PHP & MySQL Rating And Voting Script Tutorials?

Is there any good rating and voting script tutorials that use PHP and MySQL? If so can someone point them to me so I can check them out. ...

Tree data in MySql database table

I have a table that uses Adjacency list model for hierarchy storage. My most relevant columns in this table are therefore: ItemId // is auto_increment ParentId Level ParentTrail // in the form of "parentId/../parentId/itemId" then I created a before insert tigger, that populates columns Level and ParentTrail. Since the last column al...