mysql

iPhone connecting to remote SQL database

Hello, Can somebody please provide some example code to how I might connect a iPhone to a remote mysql database directly ( I know it's not the best way but is what is required for my app) What I need to do is create an NSArray of NSDictionaries that have as keys the column names and entrys the data in the column. Also I need to save t...

MySql TABLE data type

MS SQL Server has a TABLE data type which can be used in stored procedures, Does anybody know if MySQL has an equivalent data type? I've had a look over the docs but can't seem to find anything, so I presume it doesn't exist, but perhaps somebody has created a workaround ...

Mysql query help needed

Hi, i have two tables category and hotels where category.id should be equal to hotels.catid. Now how do i select 3 rows from each different category from the hotels table. I have this query: select h.* from hotels h inner join category c on h.catid = c.id order by h.catid, h.hid this selects all records, but i want to select three r...

How can I do this with MySQL partitions

I have a table with millions of rows and I want to create some partions, but I really don't know how I can to this. I mean I want to have the data which is starting with the ID 1 -> 10000 to be on partition one, and and the data that is starting with the ID 10001 -> 20000 to be on partition two; and so on...?Can you give me an example ho...

What does /*!xxxxxx statement */ generated by mysqldump mean?

I was always curious about what these comment enclosed preprocessor-like statements that mysqldump generates for me mean. Here's an example: /*!40000 ALTER TABLE abc DISABLE KEYS */; The general pattern seems to be /*![some numeric code] [some statement] */; Please point to proper documentation if exists. Otherwise explain. :) ...

Drupal 6: using too many Views module causing site to go down cos of too many mysql connection.

Hi friends, I have HostGator Baby Shared Plan . I develop Drupal site on. everything was fine at the beginning, then by the time i go further with development, site started ti work really slow. now it is not working at all. giving my sql errors like TOO many connections, etc... I created so many blocks, pages with View. so it makes my...

Mysqldump more than one table?

How can I use mysqldump to dump certain tables that start with common prefix? ...

#1130 - Host 'localhost' is not allowed to connect to this MySQL server

Wamp get this message: #1130 - Host 'localhost' is not allowed to connect to this MySQL server Any help would be amazing Thanks in advance ...

Why is this SQL query throwing Warnings?

$resultnx = mysql_query("SELECT * FROM `emails` WHERE `email` = '{$email}'"); $num_rows = mysql_num_rows($resultnx); gets this warning Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in .... ...

HQL make query searching by date (Java+NetBeans)

Hi all I have the following issue. I have a table of reserves in my MySQL DB, the date columns is defined DATETIME. I need to make a query using hibernate to find all reserves in one day no matter the hour, just that its the same year month and date, and I'm doing this public List<Reserve> bringAllResByDate(Date date){ em = emf.createE...

SELECT INTO and "Undeclared variable" error

Hello ! When I try to execute following querry: SELECT id_subscriber INTO newsletter_to_send FROM subscribers I get an error: #1327 - Undeclared variable: newsletter_to_send What is wrong with that query ? ...

Get Age of a person in MySQL

How can i get a Persons age in mysql Imagine i have a table with member.id, member.month, member.year Now i need to get age of a member in Months. Say: member.month = 1 and member.year = 2000 That would mean the age of this member is 126 because 10 Years equals 120 Months and 6 Months is 6 Months. Now the result is that the mem...

Let MySQL users create databases, but allow access to only their own databases

I want to have multiple a MySQL users to be able to issue commands like CREATE DATABASE dbTest; But I also want each of these users to be able to see and access only their own databases. All I could find was how to either create the databases by a DBA and grant the privileges on this database to the specific user: GRANT ALL PRIVILE...

Wordpress v2.9.2 fails to create databases on MAMP

Hello I am familiar with previous Wordpress installers, but in this new version I've hit something new that I don't see documented. I am attempting to install wordpress to MAMP as my localhost and I'm getting errors that indicate the table creation has failed. PHP: 5.2.11 MySQL: 5.1.37 I've used the installer interface to set db set...

MySQL Query still executing after a day..?

I'm trying to isolate duplicates in a 500MB database and have tried two ways to do it. One creating a new table and grouping: CREATE TABLE test_table as SELECT * FROM items WHERE 1 GROUP BY title; But it's been running for an hour and in MySQL Admin it says the status is Locked. The other way I tried was to delete duplicates with thi...

Find units with zero categories

Hello, I am after an SQL command to find units with no categories. Here are the tables: Unit id name UnitCategory id name UnitCategoryIndex id categoryid unitid Thanks! ...

Difference between SET autocommit=1 and START TRANSACTION in mysql (Have I missed something?)

Hey there, I am reading up on transactions in mysql and am not sure whether I have grasped something specific correctly, and I want to be sure I understood that correctly, so here goes. I know what a transaction is supposed to do, I'm just not sure whether I understood the statement semantics or not. So, my question is, is anything wron...

MySql Retrive data from same table.

Hi, I have a table which contains id, name, parentId of Top level Menus & their children like: -------------------------------------- id | name | parentId -------------------------------------- 1 | Color | 0 -------------------------------------- 2 | Flower | 0 ----------------------...

mysql storing problem

hi, i have a column like decimal(2,1) , its working well, but when i try to store a value like 10 it stores as 9.9 ..any specific reason? ...

How to prevent negative number in Mysql

Hello guys.. I have data which is starting from 0 in my database. My php will add 1 or -1 to the data depending on the user's input. My problem is that if data is 0 and a user try to subtract 1. The data become 4294967295 which is the maximum value of INT data type. Are there anyways to make the data stays in 0 even when the user...