mysql

Converting MySql DateTime type into something more friendly

I have a Java web app that reads a MySql db and returns DateTime fields. What is the best way to convert the DateTime fields returned in the resultset into something more readable? Currently the DateTime fields print as: 2008-12-14 16:30:00 but I would like something more user friendly like: 14 Dec 2008 at 16:30 I am populating an ...

JSON encode MySQL results

How do I use the JSON_encode function with mysql query results, do I need to iterate through the rows or can I just apply it to the entire results object? ...

Looking for advice on a "related videos" query on a tagged video system

Well I run a small video website and on the actual video page there is a strip of "related videos" similar to most video sides (e.g. YouTube) and currently all I'm doing is taking one of its tags randomly and finding other videos with the same tag. Not surprisingly this isn't a great method as some tags are very vague and some videos ar...

mySQL stored procedure where clause problem

Hi! I've got a mySql stored procedure that looks like this-- delimiter | create procedure GetEmployeeById(in ID varchar(45)) begin select id, firstName, lastName, phone, address1, address2, city, state, zip, username, password, emptypeid from myschema.tblemployees t ...

How to get latest record for each day when there are multiple entries per day?

I have table called dg like this: name kw date ---- --- ------------------- dg1 0 2008-10-16 01:08:09 dg1 213 2008-10-16 02:06:09 dg1 135 2008-10-16 23:05:09 dg1 0 2008-10-17 01:08:09 dg1 213 2008-10-17 02:06:09 dg2 0 2008-10-16 03:08:09 dg2 213 2008-10-16 04:0...

MySQL and Python

I'm having some troubles updating a row in a MySQL db. Here is the code I'm trying to run: import MySQLdb conn=MySQLdb.connect(host="localhost", user="root", passwd="pass", db="dbname") cursor=conn.cursor() cursor.execute("UPDATE compinfo SET Co_num=4 WHERE ID=100") cursor.execute("SELECT Co_num FROM compinfo WHERE ID=100") results = ...

MySQL-db lib for Python 3.0 ?

So, looking for a mysql-db-lib that is compatible with py3k/py3.0/py3000, any ideas? google turned up nothing. ...

Slow MySQL in a laptop(localhost), faster in a production machine(desktop)

What are the reasons when I am connecting to the MySQL server in my laptop(development machine) using MySQL Administrator it is too slow, but when I am connecting to the MySQL server in the prouction machine it is faster. Does setting on the logs have a noticeable performance drop? I have no problems before with slow connections with my ...

Tables are empty set in MySQL

I used MySQL Workbench to generate a database and now I inserted it into the command-line client using: mysql> . C:\Documents and Settings\kdegroote\My Documents\School\2008-2009\ICT2 \Gegevensbanken\Labo\Hoofdstuk 3 oef 6\pizzasecondtry.sql For some reason, the last table won't be accepted. "Cannot create table" is the error message. ...

PDO MySQL Driver on Mac

I have a mac with a custom PHP 5 install that built from about a year ago. I remember it took all Sunday and I had to compile about 20 times to get it right. The MySQL I have is from entropy and was precompiled. Now I need to get PDO with the MySQL driver working and the driver is not installed. I tried the "pecl install pdo_mysql" and ...

PHP and MySQL to design map search site

Hi Everyone, I have a project to designing a website to search Zip codes on a digital map. Somebody advised me to use PHP with postgreSQL or MySQL. My professor wants me to tell him why I chose this for a mapping site. The question is... Is there an expertise web language for GIS site ?? What is the difference if I use MySQL or MSsql ...

Circular matching. PHP / MySql

Hi I need some help with the following scenario in php. I have a db with users every user has an ID, have_card and want_card. I know how to make a direct match (one user trades with another user). But if there is no direct match but there is a circular swap like: User #1 has card A wants card B User #2 has card B wants card C User #3 ...

I'm having a helluva time with data importing (PHP MySQL)

I'm building an app that pulls data in from an excel .csv file and applying various levels of formatting, moving and mapping. Most everything is figured out except for one hitch with cleaning the data. Here is an example of the data from Excel: GREAT PERFORMANCES,GREAT PERFORMANCES,57744 ROUND LAKE RD,NEW YORK,NY "GUASTAVINO'S, INC",...

MYSQL - Cant connect to MYSQL server on 'localhost' (10061)

Hi Everyone, Ive install wamp server on my PC(it has no internet or intranet connection, Windows XP -OS). But when I access MYSQL this error popup. Can you give any idea on how can i resolve this error. thank you very much. Cant connect to MYSQL server on 'localhost' (10061) ...

PHP date issues with daylight saving

I've got a very strange bug cropping up in some PHP code I've got. The page is managing student enrolments in courses. On the page is a table of the student's courses, and each row has a number of dates: when they enrolled, when they completed, when they passed the assessment and when they picked up their certificate. The table data is ...

SQL a numbering column - MySQL

This is a sql newbie question. Basically, I want an extra column to return with my select statement to number the rows. I'm using mysql. Eg: select * from friends David Steve Joe What is the syntax to get: 1 David 2 Steve 3 Joe ...

Custom Product Attributes for eCommerce Web Site

I am creating a database using MySQL 5 for an eCommerce web site. I want the database to be as flexible as possible so that the owners of the web site can add custom attributes for various types of products. For instance, they can have a product which has 4 shirt sizes and 3 colors for each size available, or a product that has 6 shirt...

MySQL or PHP is appending a  whenever the £ is used

Answers provided have all been great, I mentioned in the comments of Alnitak's answer that I would need to go take a look at my CSV Generation script because for whatever reason it wasn't outputting UTF-8. As was correctly pointed out, it WAS outputting UTF-8 - the problem existed with Ye Olde Microsoft Excel which wasn't picking up th...

how to limit bandwidth used by mysqldump

I have to dump a large database over a network pipe that doesn't have that much bandwidth and other people need to use concurrently. If I try it it soaks up all the bandwidth and latency soars and everyone else gets messed up. I'm aware of the --compress flag to mysqldump which help somewhat. How can I do this without soaking up all th...

How would I implement a simple site search with php and mySQL?

I'm creating a site that allows users to submit quotes. How would I go about creating a (relatively simple?) search that returns the most relevant quotes? For example, if the search term was "turkey" then I'd return quotes where the word "turkey" appears twice before quotes where it only appears once. (I would add a few other rules to...