mysql

Is there a MySQL client on OSX that has great useability?

I'm looking for a MySQL client on OSX with a mac design philosophy. I've been using mac programs for too long and can't really go back to windows designed programs. I'm looking for a program that has a sleek UI and great convenience for common tasks. (For example, ss there a client that allows you to delete a row by selecting it after a ...

MySQL - Change date string to date type in place?

(Hi all. I'm new-ish to SQL and MySQL in particular. I know some PHP.) I have a table which contains a "date_string" column. For legacy reasons, this is a text field, containing the date in d/m/YY format. e.g. "22/11/09" for 22nd November 2009. Question: how could I convert all fields in this column to a standard MySQL date format (YY...

PHP time ahead of MySQL time

I run PHP and MySQL on the same machine, but both report different times. I set the timezones by the following methods: PHP: date_default_timezone_set('Asia/Kuala_Lumpur'); MySQL: SET time_zone = "Asia/Kuala_Lumpur"; The difference between two times is always exactly 24 seconds. Any idea why this is happening? I thought the times...

Adding "comments" table with an sql connection and php calling

hey.. i need to place a "comments, faq, contact us" table on my site where users will place their name and the comment they want to say to the admin of the site.. some reports about a game they've played.. the "comments" then it will be saved inside an mysql database ("games") within the given "name" and the "ipaddress" of the user (comi...

How does LinPHA populate table?

(I've spent hours looking, and I'm sure it's obvious, but I don't see it...) I've been playing with the open source image gallery LinPHA. It allows you to ftp images to a subdir called albums, and somehow it populates a table called linpha_photos from the files in this directory. I simply can't find the code that (I assume) scans that d...

What indexes can be used to improve this query?

This query selects all the unique visitor sessions in a certain date range: select distinct(accessid) from accesslog where date > '2009-09-01' I have indexes on the following fields: accessid date some other fields Here's what explain looks like: mysql> explain select distinct(accessid) from accesslog where date > '2009-09-01'; ...

What's the difference between "select max" and "select.. where column=max"?

I have two queries: SELECT id, max(index) from table; and SELECT id, index from table where index=(select max(index) from table); Is there any difference between the two? I ran the code in MySQL Query Browser and found that the results are the same. But I just feel that there should be a difference. If there is a diff, mind to at...

Error when replacing words that contain quotes in mySQL

I have updated many records already, but when it came to a word that contains a quote I get this error: "ERROR: Unclosed quote @ 1357" I know why it's giving me this error, I just don't how to solve it. Here's a sample: UPDATE invnum SET cAccountName = replace(cAccountName,'JOHN'S','BEN') Thanks in advance. ...

Am doing online Quiz type of script in PHP. It is better to use cookies or sessions.

Hi all, Am doing online Quiz type of script in PHP. User needs to attend 50 Question in 45 minutes. After that time it should close the page or Submit the answer to the next page. It is better to use cookies or sessions. How can i do that. Am novice in session concept so can u suggest the suitable code. Awaiting the earliest reply...

Connecting to MySQL DB from various hosts

How to add a host to MySQL's list of hosts it can accept connections from. ...

SQL last insert in Drupal. Is it really threadsafe?

I have a query that might be executed by several users consecutively. I'm scared that if I run the db_last_insert_id command, some users might not get the last insert id, due to concurrency. But according to: http://api.drupal.org/api/function/db%5Flast%5Finsert%5Fid/6, it sates: Returns the last insert id. This function is thread sa...

PHP MYSQL multiple or single DISTINCT/UNIQUEvalues

Currently I have this query: SELECT column1,column2 FROM table column1 needs to be distinct, column2 does not. SELECT DISTINCT column1, NON-DISTINCT column2 FROM table Now I know that doesn't make sense but I need column1 to be distinct and column2 to be anything. How would I do that. ...

SQL conditional GROUP BY: how to do it?

Let's say I have the following SQL query: SELECT Meeting.id AS meetingId, Bill.id AS billId FROM Meeting LEFT JOIN Bill ON Meeting.FK_BillId = Bill.id That outputs the following: meetingId | billId ------------------ a | NULL b | NULL c | 1 d | 1 e | 1 f | 2 g ...

How can I find the SQL statement that created a view in MySQL?

So I forgot what a column in a view actually is, and the name I gave it is too vague. Can I find the statement used to construct it? ...

How do I dump a MySQL database using ant?

I couldn't find any information about how to dump a MySQL database with an ant task. Do I have to create my own task to do this? ANT script ===generate==> myDataBase.sql ...

How to split a really long mysql result set into two lines?

Suppose you have a result that is 100 chars long but you only have a 50 char width. How do you split a MYSQL result into two rows of 50 chars each? Could you clarify the question a bit? Are you looking to insert 100 chars of data into a 50 char column? Or do you have 100 chars in the database but only have space in your app to display 5...

How can I use a variable from a subquery?

I have this query: (SELECT e.IdEvent,e.EventName,e.EventSubtitle,e.EventDescription,l.LocationName,e.EventVenue,EventStartDate,e.EventEndDate,e.EventHost,c.CategoryName,l.LocationCity,l.LocationState,e.isTBA, (SELECT s.status FROM jos_rsevents_subscriptions s WHERE s.IdUser = 72 AND s.IdEvent = e.IdEvent LIMIT 1) as status FROM jos_rse...

Is MySQL C++ Connector access to remote database possible?

I am accessing a MySQL database within a C++ app using MySQL C++ Connector. It works fine if I have the C++ and the MySQL on the same machine. So, something like the following code works fine: sql::Connection *_con; sql::mysql::MySQL_Driver *_driver; _driver = sql::mysql::get_mysql_driver_instance(); _con = _driver->con...

MySQL Connector: parameters not being added

Hey all! Looking at my query log for MySQL, I see my parameters aren't being added. Here's my code: MySqlConnection conn = new MySqlConnection(ApplicationVariables.ConnectionString()); MySqlCommand com = new MySqlCommand(); try { conn.Open(); com.C...

phpMyAdmin and latin1_swedish_ci

I create new database with utf8_general_ci collation, create test table also with utf8_general_ci collation, and then i click on my database(structure) and this is what i get: Why is that "latin1_swedish_ci" showing up? Edit: Ok how to change this, it is in phpmyadmin in "Variables" tab, under "Server variables and settings": Thi...