mysql

mysql duplicates with LOAD DATA INFILE

Hi... When using LOAD DATA INFILE, is there a way to either flag a duplicate row, or dump any/all duplicates into a separate table? ...

sql operator equivalent to !=

I want to select all the fields where a certain column is not a value I specify. I tried this but it didn't work. SELECT * FROM table WHERE columnname != value My mistake. It was another error so I thought it was wrong with != operator cause it was the first time I use it. Sorry guys! ...

php robot for maintainance of db?

i want to have an automatic maintainance of my mysql database. eg deletes all old threads, users and checks if a user hasnt been active (ive set up that javascript is updating a status column in mysql) for over 60 min, i set the persons status as logged out in mysql. stuff like that. now how should i do this part. should i write this c...

Improving Speed of MySQL Optimize Statement

I have several large MyISAM tables (data file around 1.5 GB) which I need to optimize on a semi-regular basis because the index files are getting huge. The OPTIMIZE operation takes a really long time. The status of the query while it is running is "Repair by sorting". How can I improve the performance of an OPTIMIZE statement? Will i...

PHP and AJAX problem?

When a user casts a vote the script updates my database but it wont display the following code below to tell the user its vote has been excepted. //This will output the movie id, new rating, new votes, and a message. echo "<result id='".$id."' rating='".$rating."' votes='".$votes."'>Vote cast and saved.</result>n"; How can I fix thi...

How to print the actual SQL query to a file?

Say, this is my query $stmt = "SELECT * FROM foo WHERE x=?"; How do I print the above query plus the bound parameter to the screen or to a file in PHP? When I print $stmt it says: mysqli_stmt could not be converted to string Here's my code: if ($stmt = $this->conn->prepare($query)) { $stmt ->bind_param('ss', $un, $pwd); ...

Offline tool to work with MySQL databases like phpMyAdmin?

Like phpMyAdmin has to be installed as a web application to work with MySQL databases, is there a downloadable program that can connect to a remote MySQL server to create, read, update and delete databases, tables, columns and rows? ...

Can MySQL VARCHAR's store any chars?

Can MySQL VARCHAR's store any char like nulls and newlines? ...

MySQL Multiple Join/Subquery Questions

Hi All, For about a year now, we’ve been allowing our users to login with usernames and/or email addresses that are not unique (though each user does have a unique id). Although the system handles duplicate usernames/emails elegantly, we’ve decided to finally enforce unique usernames and email addresses. I’ve been tasked with generati...

How to handle unexpected MySQL DB engine changes?

I came across this problem two or three times. One of my customer restored the backup but it modified the engine settings unexpectedly. The result, all foreign-key constraints were lost and the application started showing weird results. The second incident happened on our live production server. MySQL stopped supporting InnoDB and displ...

How to restrict refresh option?

Hi, There is a problem. I don't want that people would be able to refresh one page on my site. How can I do it? ...

Most of the scenarios in Relational Database Management System Primary Key used will be of Integer Type why ?

Its been habitual in most of the scenarios while developing a database design we set primary key as integer type for a unique identifier in the Table , Why not string ,float type for primary keys does this affect the accessibility of values or in plain words retrieval speed of values from the table will be slower ? Are there any specif...

MySQL Databases. How Many for a Web App?

I'm building a web app. This app will use MySQL to store all the information associated with each user. However, it will also use MySQL to store sys admin type stuff like error logs, event logs, various temporary tokens, etc. This second set of information will probably be larger than the first set, and it's not as important. If I lo...

Data truncated for column 'budget' at row 1"

I encountered this error when I attempted to insert something into a MySQL table. What's the possible reason? How to solve this problem? The raw value of "budget" is 800元, when inserted, it became 800, 元 is missing. ...

How to have a query with columns needing different conditions in MySQL?

For a game, I want to count the number of user sign-ups by hour (using MySQL.). Quite easy, something like that: SELECT COUNT(*), DAY(date_user), HOUR(date_user) FROM users, GROUP BY DAY(date_user), HOUR(date_user) After that, I want to only take in consideration users which have played the game at least one time. I have a second t...

mysql-python: building a completely standalone _mysql.so on Mac OS X?

I'm running a database server in a Linux VM (Ubuntu 9.10) under VMware Fusion, but coding Django on the Mac side. Installing mysql-python requires that MySQL is installed on the Mac for compiling _mysql.so into site-packages. However, after this is done, I have no further use for MySQL on the Mac side, and would rather just delete it. O...

how to insert multiple data with their own type?

<input name="names[]" type="text"/><select><option value="male">male</option><option value="female">female</option></select> <input name="names[]" type="text"/><select><option value="male">male</option><option value="female">female</option></select> <input name="names[]" type="text"/><select><option value="male">male</option><option ...

Comment Moderation

I'm planning to create a custom system for comments. I was wondering about comment moderation. For approving comments, is it as simple as just creating a field called "Moderated" in MySQL? What's a good suggestion for countering spam? Akismat? ...

How do thumbs up in comments work?

I don't even know what questions I should ask. Well, I want to create a thumbs up for my comments, but not sure how or what's the best way. Do I just create a new field for thumbs up? ...

mysql DB not adding rows with similar elements

i have created a DB with 3 columns: aid, qid and message. aid is a foreign key which will be commond with another table. comments is a varchar which stores user comments its partially working. the problem is aid is not adding duplicate values. suppose i want to add comments related to specific aid. there are 18 aid's in all. and i wa...