mysql

notifying applications on db INSERT

Consider an application with two components, possibly running on separate machines: Producer - Inserts records into a database, but does little to no reading from the database. Multiple instances may be running concurrently. Consumer - Must be notified when a record is inserted into the database by an instance of component A. May also ...

How to implement MD5 hashing in a user registration and login system?

I am using PHP and Mysql. I want to know how to send password hashed using MD5 and want to check against it when the user tries to log in. I tried it, but it's not working properly. If anyone knows how to do it, please provide me the code. ...

COUNT and GROUP BY on text fields seems slow

I'm building a MySQL database which contains entries about special substrings of DNA in species of yeast. My table looks like this: +--------------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+---------+------+-----+---------+-------+ | species | text | YES ...

How to process decimals properly in PHP?

I want to store prices like this in the mysql database: 1000 instead of like this: 10.00 And when I echo the output I want the number to be displayed with decimals and commas in the proper places. So if this is in the database: 100000 it should display as: 1,000.00 if this is in the database: 1000000 it should show as 10,000.0...

php time_sleep_until() and "Mysql server has gone away"

hello! i have script which must execute after every n minutes. n minutes is dynamic so that i could not set a cron job to call the script (at a specific time). so what i did was i stored the time after every n minutes in an array so that when the script is executed, it will first check whether the current time is in the array. if it i...

PHP MySQL Database Connection

Is it necessary to explicitly close a DB connection after executing a query (and other DB operation)? ...

php sql and classes

hi, im looking to create a web app using php, mysql. im planning to write it in classes. i have created 3 classes: CBaseUser, CWaiter, CBaseAuth so basically CBaseUser will be a parent class to CWaiter and CBaseAuth contains things like GetPasswdLen(), CreatePasswd(), GetToken(). so right now im heading to do the rest of the program ...

is my database overdesigned ?

ok im new to database design, please give me advices about this. 1 http://stackoverflow.com/questions/1823685/database-when-should-i-use-a-composite-index im not sure what does index does, but i do know we should put it when it will be heavly loaded like for WHERE verified = 1 and in search like company.name = something. a...

how to compare two mysql databases on a mac?

hi i am using snow leopard and was wondering how i can compare two mysql databases? one of the dbs is located on a remote server while the other is local thanks ...

java.net.SocketException: Broken pipe

I get this error or my jsp page every day: java.net.SocketException MESSAGE: Broken pipe STACKTRACE: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(Sock...

SQL to get rows where a date time is 5 or less days away

I tried this and it returned incorrect rows SELECT `product_id`, `expiry` FROM `products_featured` WHERE `notified_expiry` = FALSE AND `expiry` != AND DATE_ADD(NOW(), INTERVAL 5 DAY) >= `expiry` I want to select all rows where the expiry date is within 5 days from now. The rows returned were [0]=> array(2) { [...

SQL JOIN get name and all tags for item

Hi all, this is my first ever JOIN clause and I did run into a problem. I want to echo all the necessary information for my items but I don't understand how to echo all the tags for one item, right now I get a list with duplicates of items but with different tags if more than one tag is assigned for an item. Any ideas? Better ways to do...

Create MySQL table from xls spreadsheet

Dear all, I wonder if there is a (native) possibility to create a MySQL table from an .xls or .xlsx spreadsheet. Note that I do not want to import a file into an existing table with LOAD DATA INFILE or INSERT INTO, but to create the table from scratch. i.e using the header as columns (with some default field type e.g. INT) and then ins...

MYSQL data + PHP to FLOTgraphing

Hi guys, im quite new to mysql and flot graphing, but i get the general idea. This is my scenario: I receive data from a device, in which i put into mysql database. am i wrong in saying that the new data will replace the existing data in the database? i then need to plot that on a graph, how do i get(store) the old values so i can put in...

mysql order and groupby

Hi everyone! I got a MySQL table of logs. It has the following fields: id, status_id, object_id, created, modified. I'm wondering what's the best way to get the latest status for each object? Thanks in advance! Edit: My last solution was to do SELECT id, status_id, object_id, created, modified FROM (SELECT * FROM logs ORDER BY creat...

Limiting characters of password

i have a simple question.. in registration script.. how can i set the limit character of a password. sample: minimum character is 6.. so what will be the code. please help me. :-( ...

how do i search an address form a group of columns from a table (zip,state,country)?

scenarioi:- 1) User enters an address into a search field. Address maybe zip,state or country 2) Now i have to take that address which may be in any order or which may just contain the country, state or zip and check the database if the the results exists or not. Any advice on this topic would be awesome ...

Restore of MySQL Backup just stuck

I have a with mysqldumb created backup file. It's about 15GB and contains a lot of blobs. Max size per blob is 30MB. mysqldump -uuser -ppass --compress --quick --skip-opt supertext > supertext.sql Now when I try to restore the backup, the process just gets stuck. mysql -uuser -ppass dev_supertext < supertext.sql It get stuck w...

Add DATE and TIME fields to get DATETIME field in MySQL

Hi, I am trying to get a DATETIME field from a DATE and a TIME field. none of the functions in MYSQL seems useful. Is somebody aware how to do this or that if this can even be done? :) ...

How to insert datas from a table to another table ?

Hi, I have two tables : USER and USER_1 I want to insert datas from USER_1 to USER. How to do it ? I try to do it, but without success : INSERT INTO USER WHERE id IN (SELECT * FROM USER_1) ...