mysql

Connect Rails model to non-rails database

I'm creating a new web application (Rails 3 beta), of which pieces of it will access data from a legacy mysql database that a current php application is using. I do not wish to modify the legacy db schema, I just want to be able to read/write to it, as well as the rails application having it's own database using activerecord for the new...

PHP/MySQL: Storing and retrieving UUIDS

I'm trying to add UUIDs to a couple of tables, but I'm not sure what the best way to store/retrieve these would be. I understand it's far more efficient to use BINARY(16) instead of VARCHAR(36). After doing a bit of research, I also found that you can convert a UUID string to binary with: UNHEX(REPLACE(UUID(),'-','')) Pardon my ignor...

How can I write full search index query which will not consider any stopwords?

I have written a query which will perform Full Text search using full search Index in mysql Table. But my problem is that when user searches with "to go" then it will not search anything because of stopwords in mysql. So my question is, how can I write a Full Search query which will ignore the stopwords? ...

MySQL: Ignore the timestamp attribute

I have a timestamp column in my database, and i use it for almost every field, but now, i just want to update the hit counter.. and i do not want to update the timestamp column with it. I use the timestamp field to see the last 'content' update. Not for every hit. Is it possible to let mysql stop updating the timestamp column for just o...

what is called KEY

CREATE TABLE `ost_staff` ( `staff_id` int(11) unsigned NOT NULL auto_increment, `group_id` int(10) unsigned NOT NULL default '0', `dept_id` int(10) unsigned NOT NULL default '0', `username` varchar(32) collate latin1_german2_ci NOT NULL default '', `firstname` varchar(32) collate latin1_german2_ci default NULL, `lastname` va...

How to rollback the effect of last executed mysql query

I just ran a command update sometable set col = '1'; by mistake without specifying the where condition. Is it possible to recover the previous version of the table? ...

Java connectivity with MySQL

Can anyone explain me how to connect Java with MySQL? ...

select similar value from MySQL and order the result

how do I order this result?? $range = 5; // you'll be selecting around this range. $min = $rank - $range; $max = $rank + $range; $limit = 10; // max number of results you want. $result = mysql_query("select * from table where rank between $min and $max limit $limit"); while($row = mysql_fetch_array($result)) { echo $row['name']....

Mysql query problem....

I have below values in my database. been Lorem Ipsum and scrambled ever scrambledtexttextofandtooktooktypetexthastheunknownspecimenstandardsincetypesett Here is my query: SELECT nBusinessAdID, MATCH (`sHeadline`) AGAINST ("text" IN BOOLEAN MODE) AS score FROM wiki_businessads WHERE MATCH (`sHeadline`) AGAINST ("text" IN BOOL...

What database systems should an startup company consider?

Right now I'm developing the prototype of a web application that aggregates large number of text entries from a large number of users. This data must be frequently displayed back and often updated. At the moment I store the content inside a MySQL database and use NHibernate ORM layer to interact with the DB. I've got a table defined for ...

MySQL query : all records of one table plus count of another table

Hello Guys! I have 2 tables: User and Picture. The Picture table has the key of the user. So basically each user can have multiple pictures, and each picture belongs to one user. Now, I am trying to make the following query: I want to select all the user info plus the total number of pictures that he has (even if it's 0). How can I do th...

DBF to sql Converter

is there any free converter for DBF to Mysql? ...

Non-blocking MySQL updates with java?

For a multiplayer game I'm working on I'd like to record events to the mysql database without blocking the game update thread so that if the database is busy or a table is locked the game doesn't stop running while it waits for a write. What's the best way to accomplish this? I'm using c3p0 to manage the database connection pool. My be...

How is this website fixing the encoding ??

Hi all, I am trying to turn this text: ×וויר. העתיד של רשתות חברתיות והתקשורת ×©×œ× ×• Into this text: אוויר. העתיד של רשתות חברתיות והתקשורת שלנו Somehow, this website: http://www.pixiesoft.com/flip/ Can do it, and I would like to know how I might be able to do it myself (with whatever programming...

How do I select top ranker by date in MySQL

I do have a user data base with rank.what I am looking is how do I select top rank person based on today's search?? and I need to do this in daily basis. ...

Optimizing Mysql to avoid redundancy but still have fast access to calculable data

An example for the sake of the question: I have a database which contains users, questions, and answers. Each user has a score which can be calculated using the data from the questions and answers tables. Therefore if I had a score field in the users table, it would be redundant. However, if I don't use a score field, then calculating th...

mysql_affected_rows() always returns 1 even though no row was updated.

What I am trying to do is: (programmatically) Update status where id is something, if no rows where updated, give error: we cannot find the record with id something, otherwise give message success. Here I am using mysql_affected_rows() to know if a row was updated or not, but it always return 1, so the user gets a success message, even...

How to disable magento online sales functionality?

Hi there, I am implementing Magento Community edition and want to disable the "add to cart" functionality temporarily until i am prepared to proceed with online orders. I wanted to use Magento without checkout and add to cart functionality. Please advice. SIA ...

Get the full result

Is there a PHP function to get the full result with a mysql query in a multidimensional array? SELECT * FROM table Usually I would make something like this: $query = mysql_query = ("SELECT * FROM table"); while ($result = mysql_fetch_array($query){ echo $result[0]; } ...

Incorrect table name, php/mysql

Hi guys, I've got this code mysqli_query ( $userdatabase, 'CREATE TABLE `user_'.$emailreg.'` ( ID int NOT NULL AUTO_INCREMENT PRIMARY KEY, IP varchar(10), FLD1 varchar(20), FLD2 varchar(40), FLD3 varchar(25), FLD4 varchar(25), FLD5 varchar(25) )' ); echo ...