mysql

Mysql Query Confusion

Hi, I have these tables: domain domain_module domain_module_feature domain_module_feature_to_domain A domain can have many domain_module_feature(s), the domain_module_feature_to_domain table contains 3 columns - dmf_id, dmf_domain_id and dmf_feature_id. For ease of this example lets assume domain has just 2 columns - dm_id and dm_na...

Remove a bunch of escaped quotes from MYSQL.

I have an odd one - I am porting some data from one CMS to another. Both run on LAMP. In the old CMS, the data was stored, with slashes in the DB. Examples: Hi. Thanks for looking. It\'s \"awesome\". That correctly displays when output by the old CMS as: Hi. Thanks for looking. It's "awesome". But in the new CMS, they same text i...

mysql limit - a general question

Assuming the query SELECT * FROM table WHERE a='1' and b='2' and c>'3' and d>'4' and e!='5' and f='6' returns 10000 results. My question is, let's say I limit the search to the first 10 results like this: SELECT * FROM table WHERE a='1' and b='2' and c>'3' and d>'4' and e!='5' and f='6' LIMIT 10 Will mysql search through all the ...

only show tables with certain patterns in mysql "show tables"

there are too many tables in a db. how can I only show tables with certain patterns? or is there a way I can do paging like "| more" in shell command ...

I'm in need of a sanity check on a sql query that will return a value if it exists in the table or return a default value if it doesn't

What I'm trying to do is return a mailbox location for a select few users and a catch all mailbox location for everyone else. In postfix you can pass it a query in the of the form SELECT mailbox FROM virtual_mailboxes WHERE email = '%s' and it will replace %s with the email user it's looking for. I have a table that contains a set of ...

MySQL problem: Show on update

Hello! I wanted to know if its possible to display the contents of a mysql table on a page as soon as its contents are changed/updated Thanks! ...

mysqlnd driver in PHP 5.3.2 on Ubuntu 10.04

I'm trying to get the mysqlnd driver setup on php5.3.2 (default version) on Ubuntu 10.04 (Lucid). The PHP docs say that mysqlnd is compiled by default in the 5.3 builds. But I haven't been able to find a way to make it part of the aptitude build. ...

Migrating data from MSSQL to MySQL

I have a few tables in SQL Server Express that contain data with high characters - ex: Häagen-Dazs I've exported SQL inserts and when I run in MySQL they fail on these characters. SQL Express doesn't have DTS so I can't do an ODBC transformation. I've used FileMaker Pro's external table functionality but the characters show up as odd c...

MySQL - Look for best practice for FULLTEXT Search

Hello all, I am using PHP+MYSQL to provide a full text search for my system. The php is NOT based on any framework and is NOT OOP based. I am looking for some best practice (Design/Performance) from people who have experience on using this internal functions provided by MySQL. Thank you ...

How to syn identical innodb and read-only myisam tables

I am planning to have 2 identical tables, one in innodb, another in myisam. innodb table is for writing and updating and myisam table is purely for reading only. What is the best way to sync the the myisam table with the innodb table? The solution doesn't have to be real time. If I can sync them once a day, that would be good enough. I...

Combine multiple rows in table into 1 resultset row

I have a table that stores records like this: name | stat | value -------------------------- object1 | stat1 | val1 object1 | stat2 | val2 object1 | stat3 | val3 object1 | stat4 | val4 But I would like to query the data so it returns rows like this name | stat1| stat2| stat3| stat4 ------------------------------------- ob...

MYSQL CONCAT() is failing but I don't know why...

Need some help understanding why my concat() is failing and how to fix it. I've never used concat() but came accross a situation where I needed to get a unit_nbr from another table and concatenate another field to it to make one field in the main select. Here's the CONCAT() I used: CONCAT(b.name, ' - ', unit_nbr) as lease_name The out...

MySQL 1040 too many connections error, no admin privileges

I've managed to overload the connections to the MySQL database that I'm building a website around, and it's now giving me a 1040 - Too many connections error. The problem is, I have no admin access to the MySQL database, nor do I have root access to the system it's running on. (I have regular user access to both.) Is there anything I can...

How to determine connection state of Perl DBI database handler

How to determine connection state of Perl DBI database handler(is connection opend)? Something like .NET SqlConnection.State == Open. May be something like defined($dbh->do("some nop sql")) but can't find sql nop statement to use. ...

sql direct way to get number of rows in table

Hi again people of stackoverflow. I have a routine that has a step that I find unnecessary lets say you want to get all the images from a gallery, and limit a certain number of images per page. $db = PDO object $start = (pagenum x images per page) $limit = (images per page) $itemsdata = $db->query("SELECT id,name FROM gallery LIMIT $sta...

Code Igniter without a Database?

Hi everyone! Sorry if this is a simple question, is it possible to load codeigniter without a db setup? I have sess_use_db set to false in the config, I tried renaming database.php to something else but it still wants to load it, I turned active records off also. I tried commenting everything out in the database.php and it said no da...

Does anyone have considerable proof that CHAR is faster than VARCHAR ?

Any benchmark, graph anything at all ? Its all academic and theoretical across the web. Ok its not the first time that this question has been asked, they all say that using CHAR results in faster selects? I even read in MySQL books, its all the same but I have not come across any benchmark that proves this. Can any one shed some light...

Rails relational issue - Find user's next outing

I have an outings table, which basically holds some information about an 'outing'. These outings then have crews, which have users (through crew_users) Just as a note, outings have many crews, so there's an outing_id in the crews table Now, I need to find the user's next outing, as in the first outing where outing.start_time > Time.n...

How to give a unique url/id to a question posted by the user?

Hello, There's a form called discussion.php, in which a user will fill out his/her question/discussion and post it to savedisc.php. Some of the savedisc.php looks like this: $message = $_POST['message']; $title = $_POST['title']; $represents = $_POST['represents']; //connect to database //save the content of discussion/question into ...

Mediawiki Database Error 1205

I just installed a fresh copy of mediawiki on http://konton.us/wiki I was all happy playing around with my wiki, filling up the place with information and suddently, when I created an article by the name of Gameplay_Mechanics, it all went dead. http://konton.us/wiki/Gameplay_Mechanics I got this error: A database query syntax error h...