mysql

Entering Eth (Ð) into mysql

Hi All, I was wondering if anyone had experience of trying to get Eth to enter into a mysql database properly at all? I have a simple html form, processed using PHP4 code which stores the data in mysql, but i want to allow users to be able to use characters such as Ð, æ, ö and the like. I have tried different collations such as latin1 a...

MySQL: Auto incrementing combined keys

Ok, I have a table that will look something like this: Post ˪ Id ˪ Version ˪ Title ˪ Content The idea is that the Id and Version together will be the primary key since you can have a single post multiple times but of different versions. My question is this: I would like to have the Id to auto increment. Is this possible in a setu...

How we can lock a table using PHP / Drupal

Hi iam developing a module in Drupal, which needs to have a locking machanism, When one user operating on form submission other should nt take action, How do i can achieve this in php/drupal iam using mysql database with MyISAM/INNODB Please help me Thanks in advance Kamal ...

run mysql create table by select another and copied the indexes automatically

i want to run a query like this : CREATE TABLE newtable SELECT * FROM oldtable its work fine but the indexes not copied to the new table , how can i run the query and prevent the indexes ? thanks ...

MySQL partitioning query on timestamp

I running MySQL 5.1.30 on Solaris 10. As I have a table which I partition into 12 according to each month. The table structure as follow mysql> desc my_events; +-----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+----...

Extract data from Mysql::Object in ruby on rails

I have code to run sql query in ruby as follows sql = ActiveRecord::Base.connection() sql.begin_db_transaction report = sql.execute("select * from users;") sql.commit_db_transaction So after this report is an Mysql::object. Now I want to extract all fields and its corresponding data to array or hash. thanks, ...

what comes next for me?

hey, i've been running my own gaming website for about 5 years now. It's written in PHP/MySQL. I use some AJAX and have recently started using jQuery. I'm wondering how best to move forward to make my code "better". I've never used a PHP framework, and I once used OOP but didn't really feel the advantages. What could I learn to move for...

Django and "get() returned more than one Model name" error in multi-threaded program

Django's get_or_create function always cause "get() returned more than one Model name" error in a multi-threaded program. I even tried to put get_or_create statement inside a lock.acquire() and lock.release() block but still didn't work. The program only works when I set thread_count=1 The database is on InnoDB engine. How to fix this...

How to write this elegantly in SQL ?

I have a table (user) that contains user information. I have another table (userview) that records user views - that is, when one user views another users details, I record the id of the viewer and also, the id of the user he/she viewed. I want to write a query that will help me answer the question: Fetch the list of ALL users that we...

CakePHP - Generated query not working correctly with SQL Server

I have a CakePHP app that is being moved to Sql Server from MySql. There is one query that does not seem to transfer correctly: $this->Model->find('all', array( 'conditions' => array( 'Model.column' => array(1, 2, 3) ) ) ); When I use this syntax with mysql, it seems to 'unpack' the array correctly, and...

How to override table name andprefix in Magento model?

I need to make Magento read/write data to an existing database table in order to integrate with another party system. The table cannot be renamed. If I specify it in the table tag in the model config as below magento adds the prefix. Is there a way to override the prefixing somehow? <models> <arithmetic> <class>Mc...

how to run xampp on cd?

I have a product catalog using apache, php and mysql. I need to put it on a CD, so it can be run from it direclty. What possibilities are there? ...

Find adjacent rows without stored procedure

Considering the following table: someId INTEGER #PK ageStart TINYINT(3) ageEnd TINYINT(3) dateBegin INTEGER dateEnd INTEGER Where dateBegin and dateEnd are dates represented as days since 1800-12-28... And considering some sample data: someId | ageStart | ageEnd | dateStart | dateEnd ------------------------------------------------ ...

How to check with python if a table is empty?

Using python and MySQLdb, how can I check if there are any records in a mysql table (innodb)? ...

MySQL: Select Random Entry, but Weight Towards Certain Entries

I'm sick of waiting for my developers to fix this, so I decided to ask you guys. I'm trying to modify what they've already given me, so sorry if the setup doesn't make a whole lot of sense. I could probably change it but want to keep as much of the existing table setup as possible. I've got a MySQL table with a bunch of entries in it, a...

MySQL: Counting most occurrences of a field's value

Given the following query, how do I return the p_name with the most transactions? And similarly, how do I return the t_amount with the most transactions. I'd like to do it all in this one query of course. SELECT t.*, p.* FROM transactions t LEFT JOIN partners p ON p.id=t.partner_id which can return something like: t_amount t_pla...

"IS NULL" in Zend_Db_Table select not working

I'm trying to do a join on 2 tables in Zend, using the DbTable / model / mapper structure. If, in my mapper, I do this: $select = $this->getDbTable()->select(Zend_Db_Table::SELECT_WITH_FROM_PART) ->setIntegrityCheck(false) ->join('images', 'images.oldFilename = availablePict...

fetching article from mysql using slug

Hi all, i am writing my own news article section on my site, and store each article in a mysql database. Each article has a unique id, a title, the main body and thanks to the jquery plugin, it's own url-friendly slug. However, I am not sure how on earth I go about fetching the article when linking to the slug. How do i get: www.site...

Change entire db's collation and solve illegal mix of collations

Hi I'm having a problem when doing LIKE '' queries in mySQL These are my variables character_set_client utf8 character_set_connection utf8 character_set_database latin1 character_set_filesystem binary character_set_results utf8 character_set_server latin1 character_set_system utf8 character_sets_dir C:\xampp\mysql\share\charsets\ 1...

Using SSL to connect to mySQL from PHP

Hi folks, I have a security consultant demanding that we implement encrypted connections to mySQL. He is concerned that the username and pass for the db are being sent cleartext when we connect. The mysql server is on the same network as the scripts though not the same physical machine. So the credentials will not be passed externally...