mysql

how not to update timestamp field

project is written on php. There is timestamp field in mysql it updates automatically. In one case I don`t need update this field. Can I gibe instruction not to update this field in this queries without getting timestamp value. ...

how to compare dates in php and sql?

Hi, I want to make a notification system. Shortly.. to compare two dates, the only problem is that i want to compare the months. to see if a month or two have passed from last notification. i want to use one or two months from an entry in a mysql database. the client must select when the notification must come, one or two months. th...

2 Select or 1 Join query ?

I have 2 tables: book ( id, title, age ) ----> 100 milions of rows author ( id, book_id, name, born ) ----> 10 millions of rows Now, supposing I have a generic id of a book. I need to print this page: Title: mybook authors: Tom, Graham, Luis, Clarke, George So... what is the best way to do this ? 1) Simple join like this: Select...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Can someone please help as i've spent all day trying to fix this. I installed the latest XAMPP and now i can't connect to mysql from terminal.I checked my .profile file and the PATH seems ok. Does anyone know whats happened and what's the solution? PATH=$PATH:/Applications/XAMPP/xamppfiles/bin export PATH THIS IS A PROGRAMMING QUESTION...

Handle mysql restart in SQLAlchemy

My Pylons app uses local MySQL server via SQLAlchemy and python-MySQLdb. When the server is restarted, open pooled connections are apparently closed, but the application doesn't know about this and apparently when it tries to use such connection it receives "MySQL server has gone away": File '/usr/lib/pymodules/python2.6/sqlalchemy/engi...

MySQL or SQL Server

I'm creating an application that I want to run on either MySQL or SQL Server (not both at the same time) I've created two PHP classes DatabaseMySQL and DatabaseSQLSVR and I'd like my application to know which database class to use based on a constant set up at install. define(DB_TYPE, "mysql"); // or "sqlsrv" I'm trying to think of the...

Zend_Table_Db and Zend_Paginator and Zend_Paginator_Adapter_DbSelect

I have the following query: $this->select() ->where("`name` LIKE ?",'%'.mysql_escape_string($name).'%') Now I have the Zend_Paginator code: $paginator = new Zend_Paginator( // $d is an instance of Zend_Db_Select new Zend_Paginator_Adapter_DbSelect($d) ); $paginator->getA...

MySQL - Structure for Permissions to Objects

What would be an ideal structure for users > permissions of objects. I've seen many related posts for general permissions, or what sections a user can access, which consists of a users, userGroups and userGroupRelations or something of that nature. In my system there are many different objects that can get created, and each one has to ...

using PHP to create multidimensional array from simple JSON array

I have a php query the returns the following JSON format from a table. [{"memberid":"18", "useridFK":"30", "loginName":"Johnson", "name":"Frank", "age":"23", "place":"School", }, It needs the following format: [{"memberid":"18" { "useridFK":"30", "loginName":"Johnson", "nam...

MAMP Mysql in Terminal

Hello guys, I've installed MAMP on my MacBook PRO Leopard OS. Phpmyadmin is working fine but I would like to use the terminal or bash to practice MySQL. I seem to have a problem with it. When I use: mysql -h localhost -u root -p" / "mysql -h localhost -u root" ...it gives the following error: ERROR 1045 (28000): Access denied ...

connect java application to mysql server in netbeans 6.8

i am beginner in java as well as in netbeans .please give me complete procedure how i can connect my java application to mysql to insert data . ...

Help me alter this query to get the desired results - Resolved

Please dump these data first CREATE TABLE IF NOT EXISTS `all_tag_relations` ( `id_tag_rel` int(10) NOT NULL AUTO_INCREMENT, `id_tag` int(10) unsigned NOT NULL DEFAULT '0', `id_tutor` int(10) DEFAULT NULL, `id_wc` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id_tag_rel`), KEY `All_Tag_Relations_FKIndex1` (`id_tag`), KEY `id...

MySQL: fetching a null or an empty string

I know whats the difference between a NULL value and an empty string ("") value, but if I want to get a value by using the OR keyword, I get no result for a NULL value The table i want to query looks like this: titles_and_tags +----+----------+------+ | id | title | tag | +----+----------+------+ | 1 | title1 | NULL | | 2 | ti...

Turn all titles in wordpress powered site into "Capitalized" case

So what i need is a query or some tip on how to turn all titles on a wordpress powered website into capitalized case. What i have now is something like this: AAAAA BBBBB CCCCC I want it to be like this: Aaaaa Bbbbb Ccccc I did try googling and searching here, but have failed at that task so any help is much appreciated! UPDATE: I ...

MySQL Normalization stored procedure performance

I've written a stored procedure in MySQL to take values currently in a table and to "Normalize" them. This means that for each value passed to the stored procedure, it checks whether the value is already in the table. If it is, then it stores the id of that row in a variable. If the value is not in the table, it stores the newly inserted...

Attach data to Richtext using flex, mysql and php(newbie)

I'm trying to attach data to a richtext field in Flashbuilder. The data is an html string in a mysql database and I'm connecting using php. The php script is just converting to XML. The connection works because I can easily dump the data to a datagrid and I can see the string. when I try to hook the data to a Richtext field I get "obj...

Put indexes on a table with lots of BOOL/TINYINT?

An old mentor once told me to place indexes on most things you use a WHERE clause for. Should I put an index on BOOL/TINYINT's? There is a significant amount of them in the table I am working with, and often results are filtered by anywhere from 1-20 of these boolean conditions. ...

Rails advanced queries with join and sum calculation

I have two models: companies and expenses. Companies have many expenses and expenses belong to companies. My expense model has an 'amount' column. I was wondering if there is a way to perform a find based on a date range and the amount column of the expenses. Something like top 3 companies by total expense amounts over a 7 day period. ...

Joomla - Joomfish Error Blank index.php

I have joomla error since installing multilanguage with joomfish. I'm using Joomla 1.5.11 and Joomfish 2.0.4. Resulting a blank page. How to trace error? since using joomla default error reporting doesn't work. still blank page with nothing. There is K2 component also installed. Please help, cause i can't figure out the error? [Fri Jun ...

Permissions done on MySQL side or PHP side?

When I am grabbing data from my table that require permissions, should all the permission be done there? Such as checking for an admin or if they can view the data (in MySQL)? Or should I grab it if they have a record at all, then check the specific actions (such as view, add, edit, delete) on the PHP side? ...