mysql

Install custom modules in a python virtual enviroment

I am doing some pylons work in a virtual python enviorment, I want to use MySQL with SQLalchemy but I can't install the MySQLdb module on my virtual enviorment, I can't use easyinstall because I am using a version that was compiled for python 2.6 in a .exe format, I tried running the install from inside the virtual enviorment but that d...

Php: get results sets from database via mysql

I am encountering a problem while extracting info from a database using php+mysql and thought it will be good if somebody here may suggest a way out. Problematic Code: $selectedProtocols=array(1,2); for($i = 0; $i<2; $i++) { $result = mysql_query("SELECT throughput FROM session where mainProtocol='$selectedProtocols[$i]'"); while(...

How do I install the dependencies I need for MySQL::Slurp?

I am trying to install the mysqlslurp utility found in MySQL::Slurp. I found that it requires Moose and therefore I installed that package too. But I am still not able to use the mysqlslurp command. I get an error: Can't locate Moose.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi ..... BEGIN fa...

PHP & MySQL & forms -- flexible search? (ex: X ingredients can make Y recipes)

I'm just getting started with PHP/MySQL, so please forgive the rather simplistic question: As a practice example, I want to create a small dbase of recipes. Each recipe has X different ingredients. The table is simple enough I think - each row represents a recipe and each column after the first(primary key) is an ingredient with a TRUE/...

MySQL performance: Single query using GROUP_CONCAT, or two separate queries?

I have a MySQL database in which each user has an account, and each account can have multiple permissions. My ultimate goal is to end up with the account's username, and a comma-delimited list of permissions ids. There are two ways I can accomplish this: SELECT a.username, GROUP_CONCAT(rp.permission_id) as permission_ids FROM account ...

[SQL] How do I group by month and year when only having a datetime field?

I have a table schema which is essentially a bunch of transaction info with a datetime field TRANSACTION (< transactionid >, amount, when) I need to generate a monthly total of transactions, which is SUM(amount), but I stumped by what do I group by. Each row from SQL should contain the monthly total (so one row for Jan 09, Feb 09....J...

Caching in PHP.

We run a number of web applications written in PHP. Unfortunately there are some select queries within these with some pretty hefty joins which are causing MySQL to become less responsive. Because of this we are looking into caching some of the regularly used joins. I have looked into Zend_Cache which looks promising, are there any oth...

How can I speed up image load time in my web site?

I am currently developing a web site with PHP + MySQL and jQuery. So far I have been doing it in my local machine. I notice that when I see the page the images on it take some time to load (few time but its visible). All images are small (PNG's with less than 3 KB). Now, when I load the page, there are some database connections happening...

MYSQL IN or multiple conditionals

I have a simple query which is returning records based on the field status not having certain values. Lets say for arguments sake that the field can have values 1,2,3...10 and I want to return all records that don't have values 3, 7 and 9. Which of the following would be best to use? Option 1. SELECT `id` FROM `tbl` WHERE (`status` != ...

Upload and insert file data in CodeIgniter

Hi there, I'm creating a file upload in CodeIgniter, that uploads the file to the server and then stores some data in the database. I have a form that asks for a file name and the file, which then uses my upload.php controller to upload the file to the server. Currently this part is working, I just need to insert the file name (entered...

Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server

This should be dead simple, but I cannot get it to work for the life of me. I'm just trying to connect remotely to my MySQL server. connecting as mysql -u root -h localhost -p works fine, but trying mysql -u root -h 'any ip address here' -p fails with the error ERROR 1130 (00000): Host ''xxx.xx.xxx.xxx'' is not allowed to conne...

find nearest cities that have listings (businesses)

I have two data sources already in Sphinx: source cities { ... sql_query = SELECT id, city_name, state_name, state_abbr, latitude, longitude, population FROM cities; sql_attr_uint = population sql_attr_float = latitude sql_attr_float = longitude ... } source listings { ... sql_query = SE...

Java with database storage.

I have to write a program that can take bookings, store them and then access them at a later time, the application has to be written in Java. Because of this i have been looking into various ways to use a database with Java. I have been looking into using the JDBC with the mySQL driver database and also looking into the javaDB. What wou...

Autocommit vs. Single Transactions (Small Project vs. Big Project)

Hi there, I am currently working on a very specialized PHP framework, which might have to handle large database transfers. For example: Take half of the whole user count; this should be every day's workspace for the framework. So, if my framework is required by big projects, is it recommend to use single transactions with multiple qu...

Mix ascending and descending sorting in conditional sorting in MySQL

I have one table for two different kind of news. I want to create a list of them ordered by a date which depends of the type of news, so I tried this: SELECT * FROM my_table ORDER BY case type when 'news' then creation_date else 'events' then starting_date end desc; What I want is to sort news by c...

MySQL: Suggesting objects (optimizing a multi-join query)

Goal: Suggest objects based on user's choices Data: Table containing info on how users would order a subset of objects from the worst to the best; Example: 1 2 3 4 5 6 John: A B G J S O Mary: A C G L Joan: B C L J K Stan: G J C L There's about 20 times as many users as objects, every user's lineup contains 5...

automatic mysql query in PHP

How do i write a code that builds a mysql query depending on what values drop lists have? If nothing is chosen in a drop list, then the drop list value is 001 so then the query should not include this drop list in the search! Please help... I have this so far: foreach($_GET as $key => $value) { if ($value != '001') { ...

MySQL Query - Getting distinct values

There is a table "T" that contains data as shown below: A B --------- 3 5 4 6 7 10 8 5 9 12 3 6 3 7 8 7 Assuming a given input set of {3,8} as values for A, how to retrieve all distinct values of B for which all values in the input set has an entry? B --- 5 7 EDIT: I think the question is not c...

Looking For Best Practices On Building Feed Reader / Aggregator on a Cron

I have a social networking site which is beginning to gain some momentum and has an expanding user-base. We currently allow the users to import their blog, flickr and twitter feeds. We use the php library simplepie to read the feeds and then we check the DB to make sure we do not have a duplicate entry for each found feed item. If the fe...

PHP help with building query

I have several drop lists where if no option is selected then the value is = ""... I cant figure out how to build the query for mysql in PHP. query = SELECT * FROM db ...