mysql

MAMP on OSX 10.5.8 - httpd.conf file being overwritten on when I click start servers

Hi, I am using MAMP pro on osx 10.5.8 and everytime I launch MAMP, it overrides what I have set in the httpd.conf for user. It overwrites it with my current user name, and MAMP wont work unless I have both user and group set as www -- Does anyone have any idea as to how to fix this problem? Any help would be much appreciated! Thanks ...

Help with complex join conditions

I have the following mysql table schema: SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `network` -- -- -------------------------------------------------------- -- -- Table structure for table `contexts` -- CREATE TABLE IF NOT EXISTS `contexts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `keyword` varchar(255) NOT NULL, PRI...

new to mysql question php

Hello, I have a table in my database that looks like this: |id|team_name|team_url|xml| I have a cronjob that calls a script. In this script, I want to use my class to check if the url exists, and if it doesn't, delete the entry in the database. Something like this: foreach row in table, if (Security::checkUrl(team_url)), delete entry...

trying to join 4 tables with mysql

I am trying to join 4 tables but having issues. my code is listed below. The error I recieve is #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 'ON advancedcatalog_font_type.id = advancedcatalog_dimensions.font_type_id) LEFT ' at line 6 adva...

PHP: find 3-char words in query string to augment MySQL full-text search

I'm working on a simple MySQL full-text search feature on a CakePHP site, and noticed that MySQL strips short words (3 chars or less) out of the query. Some of the items in the site have 3 character titles, however, and I'd like to include them in the results. (I've ruled out using more robust search appliances like Solr due to budget co...

Effective way to separate a group into individual records.

Hi there, I'm grouping some records by their proximity of time. What I do right now (timestamps in unixtime), First off I do a sub select to grab records that are of interest of me, (SELECT timestamp AS target_time FROM table WHERE something = cool) AS subselect Then I want to look at the records that are close in time to those, S...

MySql Temp Tables VS Views VS php arrays

Hey Guys I have currently created a facebook like page that pulls notifications from different tables, lets say about 8 tables. Each table has a different structure with different columns, so the first thing that comes to mind is that I'll have a global table, like a table of contents, and refresh it with every new hit. I know inserts a...

[PHP] session_start Throws Fatal Error

I'm currently working on a small CMS for my website and I'm getting following error when calling session_start() : Fatal error: Exception thrown without a stack frame in Unknown on line 0 I'm storing the PDO database connection in the $_SESSION, so I need to call session_start() directly after starting up the script. Here's a snip...

MySQL query question.

Is there a way I can search a posts tags for related posts but exclude the posts that is being searched from the display results? If so how? And where would I place the code at in the query? Here is what I got so far. SELECT * FROM users_posts WHERE users_posts.title LIKE '%$search_tag%' OR users_posts.summary LIKE '%$search_tag%' OR u...

The best way to interact with a database, with objects

Alright, so after years of feeling that I've been doing it the wrong way, what is the best way to interact with a MySQL database, using PHP. Going to start off small-scale, but eventually hoping to grow large scale. I'd love to be able to use objects, like such $book = new Book(1342); echo $book->title; So, what is the best way to go...

Importing excel data in mysql database

Hi friends, I have a excel file with about 5000 rows to be insersted at one of my mysql databse table, can anyone give quick and dirty solution ? Thanks ...

SQL query about appointments....

Hello! Suppose we have this table.. CREATE TABLE `appointments` ( `idappointments` int(11) NOT NULL AUTO_INCREMENT, `timeStart` time DEFAULT NULL, `timeEnd` time DEFAULT NULL, PRIMARY KEY (`idappointments`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8$$ assumption Suppose that a range between timeStart and timeEnd ca...

unique field from mysql database to php

I have a sample database like this, in which, id is always unique, but the user_id is not unique. id,user_id,message,msg_datetime 111,u1, msg from u1,time present here 112,u2, msg from u2,time present here 113,u3, msg from u3,time present here 114,u2, msg from u2,time present here 115,u7, msg from u7,time present here 116,u2, msg from u...

MySQL Variables, GROUP_CONCAT, and using it later

I am storing a hard list of SELECT @items := GROUP_CONCAT(ID) FROM table_1 ... etc @items is now a string of numbers: 55,77,99,2038,2844,etc Later, I try to use it in a where clause as such: SELECT * FROM table_2 WHERE table_1.ID IN (@items) This does not work. It seems like it should. I know when I manually pull the data, put i...

Sort SQL records based on matched conditions

I have this query: SELECT * FROM table WHERE key LIKE '1,2,3,%' OR key LIKE '1,2,%' OR key LIKE '1,%' Is it posible to sort records returned from this query based on which conditions was matched first. I'd like to get all records that match key LIKE '1,2,3,%' first, then key LIKE '1,2,%' and the others after. For example, if I have t...

PHP & MySQL display problem.

When I do pagination for my comments my numbering for my comments starts over on the next page how can I fix this so my count of the comments wont start over for my comments? When I leave out pagination my numbering of my comments works fine. Im using PHP & MySQL. My counting for my comments is simple $comment_num = 1; //number commen...

rails 3 activerecord - for :joins wrong sql is generated

i have the following 2 classes. class Customer < ActiveRecord::Base set_table_name "customer" set_primary_key "customerId" has_many :new_orders, :foreign_key => "customerid", :primary_key => "customerId", :class_name => "NewOrder" end class NewOrder < ActiveRecord::Base set_table_name "viewNewOrders" set_primary_key "orderid" bel...

Trying to group similar text rows in a column of a million row table - Open to Non-MySQL approaches

I have a large number (about 40 million) of VARCHAR entries in a MySQL table. The length of the string can be anywhere between 5-80 characters. I am trying to group similar text together and thought of a possible approach: Take a row and calculate a similarity measure (like Edit Distance) with every other row and decide (I am not sure h...

Problems with drupal Database Query

Hello, i try to fetch a result with this request, which works in phpayadmin: $result_med = db_query("SELECT node.nid AS nid, node.created AS node_created FROM dr_wiwe_node node LEFT JOIN dr_wiwe_content_type_classified node_data_field_classified_valid_till ON node.vid = node_data_field_classified_valid_till.vid WHERE ((node.typ...

Query for newest record in a table, store query as view

I'm trying to turn this query into a view: SELECT t.* FROM user t JOIN (SELECT t.UserId, MAX( t.creationDate ) 'max_date' FROM user t GROUP BY t.UserId) x ON x.UserId = t.UserId AND x.max_date = t.creationDate But views do not accept subqueries. What this does is look for the la...