mysql

How do I make sure there are no duplicates in a mysql table?

Suppose I have 2 fields: first_name and last_name. It is ok to have first name duplicate, or last name duplicate, but, if both first_name and last_name are the same, do not insert! It's like 2 unique keys, linked. ...

How to use dbdeploy with SQL Server?

Guys, I need help in setting up dbdeploy for my SQL Server database and MySQL Server. The example in the dbdeploy website does not tell me how to set the drivers for SQL Server and MySQL. Am a bit lost. Sample scripts will be appreciated. Thanks ...

Does MySQL packet size cause slowdown?

I have written a program which uses a MySQL database, and transaction between the database server (a very powerful one) and the client is happening over a ADSL connection (1 Mbit/s). But I have a very very slow connection between each client and the server. Only approximately 3-4 KB/s data is send through the server. Neither the server ...

Retrieving MYSQL Join values from PHP

I have two or more tables which hold values under the same column name. Now when I join these two tables the column names stay the same. When retrieving these values in PHP ($row['name']) I encounter problems since the column 'name' is used twice. Are there any possible means of separating these two columns inside the query? SELECT ...

Fetching single row, single column with PDO

I have a mysql query that targets a single column in a single row "SELECT some_col_name FROM table_name WHERE user=:user" After I execute the statement $stmt->execute(); how do I get this single cell directly placed into a variable with no loops? In other words how to get from $stmt->execute(); to $col_value = 100; I tried the 2...

How do I embedd an audio player in a PHP page?

I am begginer to PHP, MySQL, and JavaScript developement. I have one link by the name 49(doc file),and audio file name 49(mp3file name). I'd like the audio file to play one time when the link to the doc file is clicked. Is this possible? ...

mysql create database and user script

Question Rewritten: HOMEDIR="ftpuser" REMOTEIP="1.1.1.1" MYSQLPASS="password" Q1="DROP USER "$HOMEDIR"_shop;" Q2="DROP DATABASE "$HOMEDIR"_shop;" Q3="CREATE DATABASE IF NOT EXISTS "$HOMEDIR"_shop;" Q4="GRANT ALL ON "$HOMEDIR"_shop TO '"$HOMEDIR"_shop'@'localhost' IDENTIFIED BY '$MYSQLPASS';" Q5="GRANT ALL ON "$HOMEDIR"_shop TO '"$HOMED...

How can I handle the problem whe AUTO_INCREMENT hit its limit?

Is there any good practice for this? I wish I could solve the problem when primary key hit the limit and not to avoid it. Because this is what will happen in my specific problem. If it's unavoidable... What can i do? This is mysql question, is there Sybase sql anywhere same problem? ...

mysql CREATE USER

I am logged into mysql... mysql -u root -pmypass And I have run the following command to remove the database user which worked succesfully mysql> FLUSH PRIVILEGES; DROP USER 'myuser_shop'; I can then add user successfully using the following command, again this works successfully mysql> FLUSH PRIVILEGES; CREATE USER 'myuser_shop' ...

mysql gem install fails on snow leopard. My computer is 32bit (mac mini core duo)

My end goal is local development of a Radiant CMS installation. So, need rails and a db to play nice. Previous frustrations with mysql led me to try mamp. I have installed MAMP. It is working. I am open to other avenues though. Tried to install the mysql gem but got no love. john-breedloves-mac-mini-2:~ john_breedlove$ sudo gem install...

How to import a .dmp file (Oracle) into MySql DB?

The .dmp is a dump of a table built in Oracle 10g (Express Edition) and one of the fields is of CLOB type. I was trying to simply export the table to xml/csv files then import it to the MySql, but the export simply ignored the CLOB field... (I was using sqldeveloper for that). I noticed this post explaining how to extract the CLOB t...

Select item from database based on date range

Hi all, I have a database of events, and I need to be able to show an event occuring 'today'. The events have start and end dates in the format: Y-m-d h:i:s How would I do this? I've tried queries along the lines of: SELECT * FROM tbl_events WHERE start>='2009-11-03 16:00:00' and end<='2009-11-03 16:00:00' To no avail. Any advice...

Linq to SQL and MySQL database

Is it possible to use all features of Linq to SQL for a MySQL database? ...

NOT LIKE not working in MySQL with Rails

>> Comment.count SQL (0.3ms) SELECT count(*) AS count_all FROM `comments` => 451 >> Comment.count(:conditions => ["author_website not like ?",'aaaa']) SQL (1.4ms) SELECT count(*) AS count_all FROM `comments` WHERE (author_website not like 'aaaa') => 203 >> Comment.count(:conditions => ["author_website like ?",'aaaa']) SQL (1....

Karma/reputation system

I've been creating a reddit-like site based on a very good article about popularity algorithms. I think I'm going quite well, the site's looking good and the implementation is working. What I'm missing is a karma or reputation algorithm. Much like SO, I have in mind implementing certain privileges for the best users. Do you have an ide...

Cannot get my 'delete.php to send to db and mark as dead

Is this an id problem or is there something I am missing? I am trying to get it to delete a comment...On this 'delete.php' page, $prof is the user sending the delete request, on the page that I'm trying to delete from, $auth is the sender of the comment. $prof = new User($_GET['id']); $query = "UPDATE ProfileComments SET status = 'd...

Are subqueries the only option to reuse variables?

I'd like to use MySQL in this form: SELECT 1 AS one, one*2 AS two because it's shorter and sweeter than SELECT one*2 AS two FROM ( SELECT 1 AS one ) AS sub1 but the former doesn't seem to work because it expects one to be a column. Is there any easier way to accomplish this effect without subqueries? And no, SELECT 2 AS two is no...

i have hundreds of thousands of pages i need to scan and document

i have many documents that i want to scan. every document will have about 10 different meta data tags by which i want to be able to search. so maybe i am thinking of getting a huge scanner, scanning everything in, but then how do i label evverything? i guess i will turn them into pdf files and i will put them in a mysql DB? what is the ...

MySQL Rating/Voting system (accurratly ordering by best rated taking into account number of votes)

Let's say I have a MySQL table that is something like this: software table: id int name text votes int rating int Where votes would be the number of times someone has voted for that item and rating would be the average of those votes. Example data: id: 0 name: FooBar! votes: 5 rating: 3 Now another user comes along and rates this...

Last Item In MySQL COUNT(*) Result?

Hello! Quick question... I have a query that checks for duplicates that looks like this: SELECT COUNT( * ) AS repetitions, Name, Phone, ID, categoryid, State FROM users GROUP BY Name, Phone, State HAVING repetitions > 1 ORDER BY ID DESC this works but MySQL returns the first ID in a set of duplicates. For example, lets say I h...