mysql

Adding a tool tip / bubble display without span tag or title

How would I go about displaying a tooltip when the user hover overs some text / keywords? This body of text is directly retrieved from the database so I am unable to add any span or div tags or title information to these keywords. Is there a way to automatically create tooltips for certain words that are contained in the page? Please le...

Advanced MySQl query to fetch date specific records within the same table

Hi, I need to findout a better and quick way to query MySQL table to get specific data for each day in a given date range, where the table has two date columns specifying start and end date. Table example: Promotions columns: ID startDate EndDate Discount CategoryID ======================================================...

Innodb Performance Optimization

One of the portion of my site requires bulk insert, it takes around 40 mins for innodb to load that file into database. I have been digging around the web and found few things. innodb_autoinc_lock_mode=2 (It wont generate consecutive keys) UNIQUE_CHECKS=0; (disable unique key checks) FOREIGN_KEY_CHECKS=0 (disable foreign key checks) --...

Mysql, reset id's

Hey guys, take a look at this, maybe you can help me. This code is pretty much self explanatory,it repeats itself via cron job. <?php $dbhost = 'blabla'; $dbuser = 'blabla'; $dbpass = 'blabla'; $dbname = 'blabla'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $table = '...

How does MySQL CASE work?

I know it suppose to be like: CASE WHEN search_condition THEN statement_list [WHEN search_condition THEN statement_list] ... [ELSE statement_list] END CASE But I do not understand this, (maybe because I keep trying to think of it like an if statement?) But for example if I have a field on a table called user_role, which a...

Wordpress, external query inside the loop

$qry = mysql_query("SELECT test1,test2 FROM ".$table." ORDER BY RAND() LIMIT 6"); $start = new WP_Query('showposts=6&orderby=rand'); if ($start->have_posts()) : while( $start->have_posts() && $rows = mysql_fetch_assoc($qry) ) : $start->the_post(); $test1 = $rows['test1']; $test2 = $rows['test2']; ...

How do I compare (AND) two strings which represent a binary mask in mysql?

I have a table in mysql which stores (among other columns) a bitmask as a string, for example: 000100 I'd like to perform a query which will AND these fields together to provide a result that shows when any two mask positions are both true. As an example, consider these three sample records: id name mask == ==== ==== 11 a 00...

SQL/PHP: SELECT only one row per item

Hi. I have a table containing persons information (one row per person) and another table containing persons photos filenames (many rows per person). I want to select a group of persons (based on another table) but only one photo per person. My old SQL was like this: SELECT persons.personID, persons.name, persons.photo_filename, movie_c...

mysql ReplicationDriver, slow and timeout when using roundrobin mode.

I'm using replicationdriver according to this article for DB reading round robin though several databases. http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-replication-connection.html Whenever I enabled this, I had slow db response and sometime it resulted in timeout. The DB servers are fine. I wonder whether there are imp...

SQL query with specialized ordering of results

I have a table that has 3 columns representing the stops in a bus route. ID stop_name stop_order I am wanting to return a list of stops starting with the current stop (which I know). So if the current stop is stop number 5 then what is returned will be as follows: stop_order 5 6 7 8 1 2 3 4 I tried: Select * from routes where stop...

Find out currentid next row from current id

Hey there! I'm trying to select next row from current id. How can i find out my current id? $qry = mysql_query("SELECT performerid,pic0 FROM ".$table." WHERE id > $currentid ORDER BY id ASC LIMIT 1"); ...

I can't add html rich text to mySQL database from Flex

So I want to store richtext in my database created from Flex 3's rich text editor, but I am unable to. for example this would need to be placed into the database: <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">sdfsdfdsfsdfdsf</FONT></P></TEXTFORMAT> Is it because ...

Confused about table design. How to store multiple data

I have a table for storing the postman coverage area. It has two fields postmanid covering_pincode What i am going to implement is, when a user enters a pincode in the textbox, the list of the postman covering that pincodes are displayed. My doubt is, how can i enter the values in the table 1. Multiple pincodes stored in single row l...

How to get this information when executing queries?

I'm looking for this information when executing queries: # Query_time: 11.639269 Lock_time: 0.000192 Rows_sent: 2 Rows_examined: 6509098 How can I get this from the command line? ...

Best Practices for MySQL Encryption?

I'm looking for guidance on encrypting fields (and/or tables if possible) for MySQL. I will settle for a decent tutorial but I'd really like specific tips on managing the transition from an unencrypted schema to one utilizing encrypted fields. Thanks! ...

grails/mysql timezone change

Whats the best way to accomplish changing the timezone of an app? The way I see it the following must occur: Server TZ is changed by sys admin mysql must be restarted. every time based column in the database must have all values updated, using convert_tz or equivalent. So either a mysql script must be written or a grails script that ...

Finding duplicate records in mysql based on a bitmask.

I have a mysql table which stores maintenance logs for sensors. I'd like to design a query that finds instances where a given sensor was repaired/maintained for the same reason. (Recurring problem finder.) My table (simplified) looks like this: id name mask == ==== ==== 11 alpha 0011 12 alpha 0010 13 alpha ...

Forward Engineering to SQL Server from MySQL workbench?

Is possible to forward engineer to SQL Server from MySQL workbench? ...

Deleting multiple rows from mysql with checkbox?

Hi, I would like to apologize if the duplicate of this question exist. i tried to find and could find anything here that could solve my problem.. I am using a form to get the input and update it in the mysql database, and then retrieve the records in the html form, and have defined the code for deleting the records individually through ...

MySQL: OPTIMIZE TABLE needed on table with fixed columns?

I have a weekly script that moves data from our live database and puts it into our archive database, then deletes the data it just archived from the live database. Since it's a decent size delete (about 10% of the table gets trimmed), I figured I should be running OPTIMIZE TABLE after this delete. However, I'm reading this from the mys...