mysql

Count with PDO

There are many conflicting statements around, what is the best way to row count using PDO in PHP with MySQL? Before using PDO I just simply used mysql_num_rows. FetchAll is something I won't want as I may sometimes be dealing with large datasets, so not good for my use. Any suggestions? ...

Which server can I decide for MySQL, windows or Unix/Linux/Ubuntu/Debian?

I'm working on a SaaS project and mysql is our main database. Our applications is written on c# .net and runs under an windows 2003 server. Considering maintainance, cost, options and performance, which server plattaform can I decide for MySQL hosting, windows or Unix/Linux/Ubuntu/Debian? The scenario is as following: The server I ru...

Get form checkbox values and pass them through pagination?

Hello. I need to get values from selected checkboxe's and pass that values through pagination witch is done by php/mysql. And if on another page user select other checkboxes add their values to array of earlier seleced. I need this for product compare page. In short i get checkbox values store them add checkbox values from other pages ...

MySQL Views in Navicat - How to define 'primary key'?

Often when I define a View in Navicat I receive the following message: xxx does not have a primary key. Updates to this table will be done using the following pseudo statement: UPDATE xxx SET ModifiedFieldsAndValues WHERE AllFieldsAndOldValues LIMIT 1 Obviously I only use my Views for viewing data, not updating. But this did make m...

Slow query when using ORDER BY

Here's the query (the largest table has about 40,000 rows) SELECT Course.CourseID, Course.Description, UserCourse.UserID, UserCourse.TimeAllowed, UserCourse.CreatedOn, UserCourse.PassedOn, UserCourse.IssuedOn, C.LessonCnt FROM UserCourse INNER JOIN Course USING(CourseID) INNER JOIN ( SELECT CourseID, COUNT(*) AS Le...

mysqlimport and double-quotes

We have a large tab-delimited text file (approximately 120,000 records, 50MB) that we're trying to shove into MySQL using mysqlimport. Some fields are enclosed in double-quotes, some not. We're using the fields-optionally-enclosed-by='\"' switch, but the problem is some of the field values themselves contain double-quotes (indicating i...

php: reversing mysql_real_escape_string's effects on binary

I built a webpage where users can submit a PDF which is then inserted into a MySQL database in a mediumblob for retrieval later. This all works fine, except when the PDF contains images or embedded fonts, in which case the images are corrupted and any text using the font disappears (Acrobat display a message about the missing font). I'...

Hyphens in column names in MySQL DB

May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air_port becomes air) and thus are not found. I tried replacing hyphens to underscores in my code ho...

How can I dump emails from an Outlook .pst file into a MySQL database?

What would be the easiest way to take a Outlook pst file and export all of the emails into a MySQL database? ...

asp.net with mysql

I know asp.net with mySQL is possible, but does it work well (fast and stable)? I am looking at a project for a client, they want to stay on mySQL, but they like they idea of going to asp.net from PHP. I can give them a better price by far in asp.net (more productive for me) and keep the project within their budget. BUT, am I going to r...

How does MySQL's RENAME TABLE statment work/perform?

MySQL has a RENAME TABLE statemnt that will allow you to change the name of a table. The manual mentions The rename operation is done atomically, which means that no other session can access any of the tables while the rename is running The manual does not (to my knowedge) state how this renaming is accomplished. Is an enti...

Selecting a group with the same value but with one exception

Hi, I have a table with a foreign key, status, code I would like to select the groups with the same foreign key with one record having a code of 001 and status of 'incomplete' and all the rest HAS to have a status of 'completed' id foreignkey code status ------------------------------------------...

comparing data from mysql backups

I've got a few backups of my database, and I'm trying to figure out if there is a way to compare the data in the backups to see how the data as changed over time. I do not have a timestamp on the fields I want to compare, but I do have a unique id on the row. The backups are .sql files created by using mysqldump. Is there a process fo...

Run MySQL Query after wget finishes downloading file

I need to run a specific mysql query upon wget, which is running in the background, finishes downloading a file. For example... wget http://domain/file.zip then run: UPDATE table SET status = 'live' WHERE id = '1234' How would I go about doing this? ...

What causes this error in my PHP SQL query?

I'm having a problem with my mysql php code. The code is meant to search the data base with variables inputted by the user and bring up the corresponding results. For example if I searched for only colour photos only colour photos would be listed with the name of the artist, size etc. But I am getting an error message and I don't underst...

How to exclusive lock mysql database?

I have multiple mysql databases and I want to perform some administration tasks on a particular database. How do I ensure that no one else can connect to that database while the tasks in progress? ...

MySQL Resource limits

whenever i set a Resource limits for particular user/database/host does it spread through the hour? it'll delay queries or does it won't allow you to query would throw some sort of an error or something? ...

How do you use MySQL InnoDB tables on OS X?

I had trouble using InnoDB MySQL 5.0 on OS X because of a my.cnf settings issue. Listing the gotchas in case it helps anyone: If InnoDB is disabled, check the error log (hostname.err, in the data directory). I had an empty setting which I changed: innodb_data_file_path = ibdata1:10M:autoextend Hope this helps someone. I was running ...

JPA: Id column settable both automatically and manually

I'm using MySQL and have the following entity: class MyEntity { @Id @GeneratedValue(strategy=IDENTITY) @Column(name="id") private Integer id; } However, I would still like to be able to set the id manually! The problem is that INSERT will never insert the id column. E.g., when doing this: MyEntity e = new MyEntity();...

Help me to revised mySQL Query [closed]

Hi All, I am trying to check if a regulation's date reminder is today and regulation's date end not yet passed then I do not want it to display. the problem is the query that I made isn't work in mysql. Can anyone help me to revise my query? Here is my query: $query="select * from t_regulation where dt_reminder >= '$today' and dt_e...