mysql

After importing sql files indexes in place, but not actually indexed

I imported all of our database to a new server. When I looked at the tables I see the indexes, but they all show a cardinality of 0. If I remove one index and add it back in, it triggers all the other indexes to run, but there's 180 tables. Is there a way to force all the tables to run their indexes? ...

how to store current_date in user variable

Why can't I write like this? set @date = SELECT CURRENT_DATE; and how do i store return value of CURRENT_DATE in user variable? ...

php query is not running??

$query="select * from fsb_profile where fsb_profile.profile_id=('select fsb_friendlist.friendlist_friendid from fsb_friendlist where friendlist_memberid='".$id."'')"; $sql=mysql_query($query); while ($t = mysql_fetch_assoc($sql)) { echo "hai"; echo $t["profile_name"]; } this code in not running why? error:- Warning: mysql...

Storing Schedule in Database

How do i store routine or schedule in Database in efficient way.Such as i have 20 rooms and in this rooms 8-10,10-12,... this way classes are held.How do i store this sort of schedule in database in efficient way? ...

How to import sql files which are more than 10mb in mysql database.

Hi I am trying to import a sql file which is more than 10 MB. But i can't do it. Its there any way to import a file which is more than 10MB using MYSQL. EDIT: I am having a mysql dump file which is more than 10MB. I can't able to import it in my localhost. While i do the following error is occured. ERROR: You probably tried to uploa...

Can't insert to database in wordpress

I tried to insert values to database table in wordpress, but it is showing some errors as below [type] => 2048 [message] => is_a(): Deprecated. Please use the instanceof operator [file] => /var/www/html/workbench/Shinod/wordpress/wp-includes/classes.php [line] => 724 Can anyone help me? ...

PHP & do/while loop memory leaking

I have a do/while loop that goes over database rows. Because it runs many days at the time processing 100000s of rows, memory consumption is important to keep in check or it will crash. Right now every iteration adds about 4kb to script's memory usage. I'm using memory_get_usage() to monitor the usage. I unset every variable used in the...

Indexing every column in a table

I have a couple of questions regarding MySQL indexing: 1) Is there any speed increase when indexing a table stored in memory? 2) When searching my table I match on column field, would indexing every column defeat the purpose of an index? Many thanks. ...

Set table names using user-defined variables in MySQL stored procedures

Hello, I want to create a table with a name taking from a user-defined variable. The following code doesn't seem to work (I get a MYSQL syntax error near CREATE TABLE line) Thanks in advance for the help SET @ratingsNewTableName = CONCAT('ratings_', 'anotherString'); CREATE TABLE IF NOT EXISTS @ratingsNewTableName ( `id` INT(11) N...

Which problems can delimiting DB identifiers cause?

Hi. I've just found the following in the Doctrine manual: Just because you CAN use delimited identifiers, it doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve. Anyway, it may be necessary when you have a reserved word as a field name (in this case, we suggest you to chan...

How to find a time delta of a datatime row in mysql?

I have a column in a database which provides datetime stamps for series of sensor readings. I'd like to segment those reading into unbroken, continuous sets of sensor readings. If a sensor reading is broken, then there will be a discontinuity in the date time column. And so I'd like to perform a query on the datetime column and then comp...

Way to know table is modified

Hi , There are two different processes developed in Java running independently, If any of the process modifyies the table, can i get any intimation? As the table is modified. My objective is i want a object always in sync with a table in database, if any modification happens on table i want to modify the object. If table is modified c...

Mysql Stored Procedures Dynamic Queries

Hi guys, I've had quite a few problems and know that I can get some good answers here! Ok kinda 2 part question. Part 1 I'm doing some really big updating of data, kind rejiging the tables mostly. so the question is should I be using a mysql stored procedure or mysql/php like normal. I'm currently on the stored producure frame of mind. ...

MySQL active connections at once, Windows Server

Hi, I have read every possible answer to this question and searched via Google in order to find the correct answer to the following question, but I am rather a novice and don't seem to get a clear understanding. A lot I've read has to do with web servers, but I don't have a web server, but an intranet database. I have a MySQL dsatabase ...

Seam Hibernate Cannot open Connection

I am trying to create a menu. And, for some reason I get "org.hibernate.exception.GenericJDBCException: Cannot open connection" error, but same project works just fine on my desktop, I don't get it. Here is the stack trace: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connect...

How to order SQL rows in order to create nice looking rollup?

This is my table: CREATE TABLE t (id INT, parent INT, FOREIGN KEY(parent) REFERENCES t(id)); This is a collection of data I have: id parent 1 NULL 2 NULL 3 1 4 1 I would like to select them and order like this: id parent 1 NULL 3 1 4 1 2 NULL I can't find a proper way to do it (in MySQL 5+)....

Facing problems in fetching the data from php web services installed in cake-php from iphone.

Hi everybody! I'm new to php and have zero exprience with the cake-php. I created the php web services, which reads data from MySql and return to my iphone app. Previously I used the same code successfully in many app, But now I'm facing the problems in it. Because the web server on which I installed my web services is cake-php based. wh...

Redbean O/RM store "date" as varchar(255) ?

From this code: $toolbox = RedBean_Setup::kickstartDev("mysql:*****************"); $r = $toolbox->getRedBean(); $test = $r->dispense("test"); $test->nom = 'Test #1'; $test->date = '2010-07-08'; $test->date_deux = '08/07/2010'; $test->num = 5; $id = $r->store( $test ); I get this SQL: CREATE TABLE IF NOT EXISTS `test` ( `id` int...

Recursion & MYSQL ?

I got a really simple table structure like this: Table Page Hits id | title | parent | hits --------------------------- 1 | Root | | 23 2 | Child | 1 | 20 3 | ChildX | 1 | 30 4 | GChild | 2 | 40 As I don't want to have the recursion in my code I would like to do a recurisive SQL. Is there any SELECT sta...

MySQL GROUP BY quantity

Hi, all! MySQL table is like this (VoteID is PK): VoteID VoteValue CommentID 1 -1 1 2 -1 1 3 1 1 4 -1 1 5 1 2 6 1 2 7 -1 2 I need a result: CommentID Plus Minus 1 1 3 2 2 1 ...