mysql

Mysql Syntax Error

Any idea why this is popping up :( ? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE `clocks` ( `id` int(11) NOT NULL AUTO_INCREMENT, ' at line 6 ** Here is the query ** CREATE TABLE `clients` ( `id` int(11) N...

Getting the final value to this MySQL query...

I've got my database set up with three tables - code, tags, and code_tags for tagging posts. This will be the SQL query processed when a post is submitted. Each tag is sliced up by PHP and individually inserted using these queries. INSERT IGNORE INTO tags (tag) VALUES ('$tags[1]'); SELECT tags.id FROM tags WHERE tag = '$tags[1]' ORDER ...

mySql Delete only removes the data not the entire entry

Hi all I have this line in my php code `$insert = "DELETE FROM allocation_table WHERE job = '$jobnumber' " ; Mysql_query ($insert) ;` The problem is it will remove all the values from the the one line in my table but not the entry itself. as you can see in the picture if I delete where job = 315 , it does not delete the line but do...

How can I remove the unique option from a column in MySQL ?

Hello, I have a field in my db called "user" which is unique. I would like to remove the "unique" option so I can have couple of users with the same nickname. Which sql statement should I execute to perform this action ? Thanks ...

can i perform cascaded delete using foreign key constraints in MySql 3.0 ?

can i perform cascaded delete using foreign key constraints in MySql 3.0 ? ...

Is the backslash \ counted as a character in MySQL?

Hello, if i have a table which has columns with fixed lenght, Will mySQL count the backslashes as characters? Example : people(name[10],age[3]) If i store in the name column a MySQL escaped value like : Blahblah\'s Will MySQL cut it at the quote? Thanks ...

How does this Switch statement know which case to execute? (PHP/MySQL)

Here is a code form a PHP+MySQL book I am reading and I am having trouble understanding this code. This code is about checking a file uploaded into a database. (Please excuse any spelling errors if any, I was typing it in) Q1: How does it know which case to echo? In the whole code, there is no mention of each case. Q2: Why do they ski...

Possible to recover mysql root pass with sudo server access?

I've inherited development for a website on vps hosting, and have login info for a user with sudo privileges, but don't have the password for the mysql root user. After digging around a little, it looks like the only way to fix this is to stop mysql (something like this: http://waoewaoe.wordpress.com/2010/02/03/recover-reset-mysql-root-...

Script working with mysql and php into a textarea and back

I am trying to write a custom script that will keep a list of strings in a textarea. Each line of the textarea will be a row from a table. The problem I have is how to work the script to allow for adding, updating, or deleting rows based on a submit. So, for instance, I currently have 3 rows in the database: john sue mark I want to b...

MySQL - Fulltext Index Search Issue

Hi all, Two rows in the my database have the following data: brand | product | style ================================================= Doc Martens | Doc Martens 1460 Boots | NULL NewBalance | New Balance WR1062 SG Width | NULL Mininum word length is set to 3, and a FULLTEXT index is created across all ...

Mysql bulk delete problem

Hello, Anybody can help me with this mysql query: delete from generic__campaings_included where dealer_id not in ('2,3,4') and campaing_id = '1' When i execute this query i didnt get normal result. Exceot 2 (dealer_id) all rows deleted. How can i use "not in" with "and" operator? PS. Sorry for my english) ...

Safest LAMP encrypt method

Hello, what is PHP's safest encrypt/decrypt method, in use with MySQL - to store let's say passwords? Of course, not for portal purposes - hashing is the safest option there. I want to do little password (domain/mysql/ftp...) storage for our whole team online, so we could log in and check to passwords, but I don't want really to endan...

How can I write a MySQL query to check multiple rows?

I have a MySQL table containing data on product features: feature_id feature_product_id feature_finder_id feature_text feature_status_yn 1 1 1 Webcam y 2 1 1 Speakers y 3 1 1 ...

sql query question / count

Hi, I have houses that belongs to streets. A user can buy several houses. How do I find out, if the user owns an entire street? street table with columns (id/name) house table with columns (id/street_id [foreign key] owner table with columns (id/house_id/user_id) [join table with foreign keys] So far, I'm using count which returns th...

How can I INSERT rows into a new table and update the primary key of the transported items?

The new table has an auto-increment that I want to use for the data that I'm transferring. Here is the query I want to run. INSERT INTO `xyz_1mydata` SELECT * FROM `xyz_1production` WHERE `xyz_1production.Id` > '12000'; I don't want to replace the existing items in #_1mydata. ...

MySql: How to know if an entry is compressed or not

I'm working with python and mysql and I want to verify that a certain entry is compressed in the db. Ie: cur = db.getCursor() cur.execute('''select compressed_column from table where id=12345''') res = cur.fetchall() at this point I would like to verify that the entry is compressed (ie in order to work with the data you would have to ...

Broken count(*) after adding LEFT JOIN

Since adding the LEFT JOIN to the query below, the count(*) has been returning some strange values, it seems to have added the total rows returned in the query to the 'level': SELECT `n`.*, exp_channel_titles.*, round((`n`.`rgt` - `n`.`lft` - 1) / 2, 0) AS childs, count(*) - 1 + (`n`.`lft` > 1) + 1 AS level, ((min(`p`.`rgt`) - `n`.`...

MySQL - Find entries that refer to a specified index.

Hi, So I have a booking system where I have a 'lesson_type' table with 'lesson_type_id' as PK. I have a constraint in place here so I can't delete a lesson_type if there are bookings made for that lesson_type. I would like to be able to determine if this lesson_type_id is being referred to by any entries in the bookings table (or any ...

IF expression in SQL

INSERT INTO item_quotation (item_id, quotation_id,name_searched,item_name,other_name,selling_price,discounted_price) SELECT DISTINCT I.item_id," . $quotation_id . ",T.item_name, I.name,I.other_name, INV.selling_price, I.discounted_price FROM temp_quotations T, item I, inventory INV<br/> WHERE ( I.name LIKE CONCAT( '%', T.item_name, '%'...

Mysql gem troubles with Snow Leopard upgrade

I have done everything that is on the web (i think) i have the new 64 bit xcode that came with snow leopard installed completely removed mysql, removed gems compeltely, removed rails installed mysql 64 bit, installed gems, installed mysql gem with the env ARCHFLAGS set I still get this nasty NameError: uninitialized constant MysqlCom...