mysql

mysql insert and buffers, is this possible

how is this possible first i do insert into table2 select * from table1 where table1.id=1 ( 50k records should be moved 6 indexes has to be updated ) second delete from table1 where id=1 ( 50k records are removed ) How is it possible that only 45k of records are moved? Im scratching my head over this and cant find a right answer Is...

What database field should this be?

I have a table called "Event". A column has "duration"--which is...how long that event lasts. What database type should this be? Integer? (in seconds)? In the future, I will do statements such as: If now() > event.duration THEN don't display the event. ...

Setting up a multi-site CMS, collecting thoughts about the DB schema

Hello all, I'm collecting some thoughts about creating a multisite CMS. In my opinion there are two major approaches. All data is stored into 1 database, giving me the advantage of single point of updates; Seperated databases, so each client has its own database. Giving me the advantage to measure bandwith. Option 1 gives me the dis...

What is cardinality in MySQL? PLease explain simple non technical language...

What is cardinality in MySQL? PLease explain simple non technical language... If a index detail of any table displays the Cardinality of a field say group_id as 11, then what does that mean? ...

ERRNO: 2 Division by zero error

I am getting this error : ERRNO: 2 TEXT: Division by zero LOCATION: C:\xampp\htdocs\final\classes\customer.php, line 183, at April 2, 2010, 3:49 pm I have the following function in my class Customer public static function GetQuotationDetails($string) { $sql = 'SELECT I.name, I.discounted_price, I.other_name ...

Problem in Fetching Table contents when adding rows in same table

Im trying to write a function for adding category: function addCategory() { $cname = mysql_fix_string($_POST['cname']); $kabst = mysql_fix_string($_POST['kabst']); $kselect = $_POST['kselect']; $kradio = $_POST['kradio']; $ksubmit = $_POST['ksubmit']; $id = $_POST['id']; if($ksubmit){ $query = "INSERT INTO category VALUE...

Fail to install mysql on cygwin, No curses/termcap library found

Fail to install mysql on cygwin. When do ./configure, experienced following error: checking for termcap functions library... configure: error: No curses/termcap library found any idea? ...

MySQL: I need to get the offset of a item in a query.

Mysql: i need to get the offset of a item in a query. I have a image gallery: this show 6 image per stack, so when i request image 22 it shows images from 18 to 24. It should first get the offset of the image 22, then get the images from 18 to 24. Another example: i request the image number 62(and offset 62), it will select images with...

Error querying database in PHP, MySQL

Hi guys, I have this code in PHP. It connects to the DB fine, but pops an error, when tryinto to insert the info. $dbc = mysqli_connect('localhost', 'root', 'marina', 'aliendatabase') or die('Error connecting to MySQL server.'); $query = "INSERT INTO aliens_abduction (name, email) VALUSE ('John', '[email protected]')"; $result = mysql...

Coldfusion 8 access to MySQL database without datasource

My webhosting doesn't allow us to access and modify the datasource, but having CF8, anyone have done access to mysql before? Do I need to use PHP? ...

Query next/previous record

I'm trying to find a better way to get the next or previous record from a table. Let's say I have a blog or news table: CREATE TABLE news ( news_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, news_datestamp DATETIME NOT NULL, news_author VARCHAR(100) NOT NULL, news_title VARCHAR(100) NOT NULL, news_text MEDIUM...

MySQL and GROUP_CONCAT() maximum length

Hello everyone, I'm using GROUP_CONCAT() in a MySQL query to convert multiple rows into a single string. However, the maximum length of the result of this function is 1024 characters. I'm very well aware that I can change the param group_concat_max_len to increase this limit: SET SESSION group_concat_max_len = 1000000; However, on th...

How can I sync a database driven website to a different server

I have a website using cPanel on a dedicated account, I would like to be able to automatically sync the website to a second hosting company or perhaps to a local (in house ) server. Basically this is a type of replication. The website is database driven (MySQL), so Ideally it would sync everything (content, database, emails etc.) , but...

MySQL floating point comparison issues

I ran into an issue by introducing floating point columns in the MySQL database schema that the comparisons on floating point values don't return the correct results always. 1 - 50.12 2 - 34.57 3 - 12.75 4 - ...(rest all less than 12.00) SELECT COUNT(*) FROM `users` WHERE `points` > "12.75" This returns me "3". I have read that the ...

INNER or LEFT Joining Multiple Table Records Into A Single Row

Phone Table +----------------+-------------+ | Field | Type | +----------------+-------------+ | f_id | int(15) | | f_client_id | int(11) | | f_phone_type | varchar(50) | | f_phone_number | varchar(13) | +----------------+-------------+ Clients Table +-----------------------------+------------...

What kind of index do I need for fast '%term%' lookups?

I am using MySQL. I have several lookups like this: SELECT * from users WHERE user_name LIKE '%search_term%' What index do I need to make these lookups fast? ...

Why does the minus operator give different result than the TIMESTAMPDIFF() function in mysql?

Since TIMESTAMP in mysql is stored as a 32bit value representing the time interval from 1970-jan-1 0:00:00 in seconds, I assumed that using minus (-) operator on TIMESTAMP values would give the difference of these values in seconds. Actually not: +---------------------------------------------------------------------+ | TIMESTAMP("2010-0...

Backup & recovery of multiple MySQL databases (InnoDB & MyISAM)

I am working on nightly and hourly backups of MySQL Databases. There are multiple MySQL databases which are either InnoDB or MyISAM (Note: Each database is either InnoDB or MyISAM for a reason). With the 2 different types I want to make sure I am grabbing everything that is needed for backup and recovery. Here is my current plan Nightly...

Deleting rows from multiple tables in MySQL

Here is what i'm trying to do: Delete a project from the projects table and all the images associated with that project in the images table. Lets say $del_id = 10 DELETE FROM projects, images WHERE projects.p_id = '$del_id' AND images.p_id = '$del_id' What is wrong with this query? ...

MySQL: Query Cacheing (How do I use memcache?)

I have an query like: SELECT id as OfferId FROM offers WHERE concat(partycode, connectioncode) = ? AND CURDATE() BETWEEN offer_start_date AND offer_end_date AND id IN ("121211, 123341,151512,5145626 "); Now I want to cache the results of this query using memcache and so my question is How can I cache an query using memcache. I am...