mysql

PHP: Files or database

What's better? I want to share a script where some data (4 ints (between 0 and 2000) and a string (length up to 200)). Should I store them in files or in a MySQL database? I use normally databases, but in this case are files also not that bad (to handle). The problem is that there are partial in one day over 100.000 inserts. That are s...

Why does my MySQL MATCH() AGAINST() query fail with columns from LEFT JOIN'd databases?

I've got a MySQL query somewhat like the following: SELECT * FROM products LEFT JOIN descriptions ON products.DescriptionID = descriptions.ID WHERE MATCH (name, overview, specs) AGAINST ('ram'); All columns I'm trying to search with MATCH() AGAINST() are FULLTEXT, but I get the following error when testing in phpMyAdmin: #1210 - I...

error in mysql statement using IF@@

I seem to have an error in my sql statement below $mysql = mysql_query( "UPDATE rsvp SET (`userid` = '$userid' , `screenname` = '$screenname' , `picture` = '$profile_image_url' , `status` = '$rsvpstatus') WHERE eventid='$eventid' IF @@ROWCOUNT=0 INSERT INTO `rsvp` (`userid`, `screenname`, `picture`, `eve...

MySQL INSERT INTO / ON DUPLICATE KEY with SELECT statement issue

Howdy - I'm a MySQL Noob. I have a table of various business listings and I am trying to populate a second table called cities that contains unique city names along with a count of how many listings per city. I'm able to do a SELECT statement that gets me this data fine like so: SELECT city,state,sum(count) FROM ( SELECT city,state, 1 A...

Syntax help! Php and MYSQL

Original: $sql = "SELECT DATE(TimeAdded) AS Date, $column_name FROM Codes ORDER BY TimeAdded ASC"; Altered: $sql = "SELECT DATE("m", TimeAdded ) AS Date, ColumnName FROM TableName ORDER BY TimeAdded ASC"; TimeAdded was added using NOW() and basically, I am trying to make it months. The problem I have here is the quotations is messi...

Mixing of Group Columns with No Group Columns

Hello. I got this error and Im not sure how to work with it. Simple explanations would be much appreciated. Thanks. Error: There was an SQL error: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause - SELECT email, COUNT(*) AS records_found FROM (emails) WHERE email = 'Emai...

Loop and MySQL help!

Okay, basically... i am trying to store the dates and month name from my database in this format. I am aiming store the month and then count the entries in that month and then store the count. This is my loop, but I have trouble formatting the array properly. while ( $row = mysql_fetch_assoc($res) ) { if ($row['Date'] != $prev_date) {...

How to delete mysql db rows remotely?

Can I run mysql delete row remotely from other machine? Something alike mysqldump which run locally dumping data on other remote machine. ...

I can not find my.cnf(MySQL configuration file) on my computer.

My computer is Windows XP. I need to find this file to get all privileges back to the root user. I accidentally removed some privileges of the root user. I still have the password and there is no problem for me to log in to MySQL as the root user. But I can not alter a table. ...

How to find out where a COMMIT might be happening?

I'm refactoring some code, converting a number of related updates into a single transaction. This is using JDBC, MySQL, InnoDB. I believe there is an unwanted COMMIT still happening somewhere in the (rather large and undocumented) library or application code. What's the easiest way to find out where this is happening? There must be s...

How to get all privileges back to the root user in MySQL?

I have logged in to MySQL with the --skip-grant-tables option. But I don't know how to get all privileges back to the root user. Error SQL query: GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost'; MySQL said: Documentation 1290 - The MySQL server is running with the --skip-grant-tables option so it cannot...

Storing hexadecimal values as binary in MySQL

I was thinking about how I'm storing passwords in my database : appropriately salted SHA1 strings in a CHAR(40) field. However, since the character data in there is actually just a hex representation of a 160 bit number, I thought it might be better to store it as BINARY(20). CREATE TABLE users ( password BINARY(20) /* snip */ )...

normalize mysql tutorial please...

Is there a good guide for normalizing a mysql db? I have only knowledge about phpmyadmin... Thanks ...

Optimize mysql query

Hi All, I want to optimize this query as it is taking long to execute almost a second Here's the query: IF Exists( Select CustFirstName From Customers Where (CustFirstName = InputCustFirstName) OR (CustLastName= InputCustLastName) OR (Email = InputEmail) ); All these three columns have Unique index on it. and I have 765...

how would you normalize / optimize this mysql database?

I have a classifieds website, with alot of categories. When the user posts an 'ad' on the website, there are some basic info (name, city, price, headline, text etc...) that has to be filled in. And also, depending on what 'category' the user choses to insert the ad into, some more fields will have to be filled in, for example: if the ca...

How many columns can you have (maximum) in a MySQL table?

What's the max number of columns a mysql table can have? ...

MySQL SELECT last few days?

I was playing with MYSQL and I know there's a limit command that shows a certain amount of results, but i was wondering if MySQL alone can show only the last 3 days or something. Just wondering. Update: I used NOW() to store times. ...

word and line count from file

hi frnds,i am having one table a which contails all doc files i want to count the words from that doc file while editing or after editing and saving...please anyone help me out ...

MySQL ORDER BY optimisation on range

Hello, I'd like MySQL to use the index to sort these rows. SELECT identity_ID FROM identity WHERE identity_modified > 1257140905 ORDER BY identity_modified However, this is using a filesort for sorting (undesirable). Now, if I leave off the ORDER BY clause here, the rows come out sorted simply as a consequence of using the in...

Remote Mysql access

Hello Techies, I have problem to connect remote LAN MYSQL. While try following commands it shows like an error. mysql -u root -h 192.168.1.15 -p GRANT ALL test.* TO root'192.168.1.15' IDENTIFIED BY ''; ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.15' (10060) Thanks in advance ...