mysql

CakePHP Connection problem

Hi guys! I'm having a little problem here. I'm starting with CakePHP and i've created the example database from the book CakePHP from Novice to Professional. So, i've my mysql database created and everything seems to be right. I've many databases and can access all without any problem. But today, after Baking some controllers, somethin...

Create Domain in MySQL

Please help me to create domain in MySQL. I have tried to run the followoing statement in MySQL but got syntax error: create domain age as int(2); ...

Retrieving widget data with MySQL query in WordPress

I've built up multiple dynamic sidebars for front page item manipulation. Each sidebar contains a Text widget, and I want to retrieve each widget's content (according to widget ID) from wp_options. Basically, the structure is dbName -> wp_options -> option_id #92 contains the following: a:9:{i:2;a:0:{}i:3;a:3: {s:5:"title";s:0:"";s:4:...

Does a free MySQL Relationship Diagram Generator Exist

Are there any free tools available for generating ERDs from an existing MySQL database? I've been given the requirement to generate such documentation for a legacy database and would prefer to not have to do it by hand. ...

Database Outline Design for Shopping cart

Hello, I'm looking for the best way to design a shopping cart. I'm at a crossroads with how to handle a product that has multiple options being color and size. The main issue being inventory management for the colors and sizes. Currently on admin panel: textfield for color textfield for quantity User seperates colors by comma along ...

Case In-sensitive query in php

Hello! I try to make a registration form. When user post the fields, i check USER_NAME. If exist then no inster the row to MYSQL. After post: $check = "SELECT name FROM test WHERE name='".$_POST['user_name']."'; $result = mysql_query($check) or die (mysql_error()); $numrows = mysql_num_rows($resutl); if ($numrow != 0){ ech...

Mac OS X 10.5 Apache and Subversion upgrade alternatives

I've found myself down a rabbit hole and would like advice. It looks like Mac OS X 10.5.8 comes bundled with a pre-configured version of Apache 2.2.11 (located in /usr/sbin), PHP 5.2.10 (located in /usr/bin) and subversion 1.4.4 (located in /usr/bin). I have installed MAMP for MySQL 5.0.41 (located in /Applications/MAMP/...) which come...

Select 2 COUNT()'s from MySQL query

I am working on a rankings page for a game and am looking to order the rankings first by wins, and then by losses (in case of people having the same number of wins). The following query works fine in order to make a list in order by wins, but I am not sure how to put losses into this query. SELECT username, COUNT(id) AS wins FROM tb...

Helper script/tool for "one a day" reminders applications

I am looking for a helper tool/ script that can be used to power an application that presents some randomized content periodically eg once per day. Example applications are "One a Day Bridal Prep", "Daily Quotations", "Daily Programming Tips" etc etc It is simple enough to code one up myself but I am wondering if I don't need to reinvent...

Select ISO 8601 Timestamp from MySQL Database

Hello, I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to pull my timestamp from the database and convert it to ISO 8601 format. Like this 2008-07-17T09:24:17Z Currently, my timestamps are in the database in this format: 0000-00-00 00:00:00 I have tried using timeago with my currently formatted time...

How can I optimize this SQL query to get rid of the filesort and temp table?

Here's the query: SELECT count(id) AS count FROM `numbers` GROUP BY MONTH(created_at), YEAR(created_at) ORDER BY YEAR(created_at), MONTH(created_at) That query throws a 'Using temporary' and 'Using filesort' when doing EXPLAIN. Ultimately what I'm doing is looking at a table of user-submitted tracking numbers and co...

Can't connect to mysql using Bitnami lamp stack through php

Ok, this will be a long question. I'm trying to get something up and running on my university account. We have a public_html folder that we can use as web space to host anything we want there. I've installed Bitnami lamp stack in the public_html folder (probably not the best idea, security-wise, but I'm only going to test this applica...

Database agnostic now() datetime function?

I've the following condition in one of my model which works for mysql. with_scope :find => { :conditions => "starts_at <= now() AND ends_at >= now()" } But I get error on the sqlite3 test database coz that now() is specific to mysql db only. What would be a db agnostic way for that now() function? ...

How can I format the mysql prompt output?

The mysql prompt spits out column data in a messy format, is there a way to format it? ...

Problems with java app and remote dbase

Hi. I'm having trouble with my java app on the database side of things. It uses connectorJ to communicate with a mysql dbase and works perfectly fine locally. When communicating with a remote dbase, it performs dismally. It's takes ages to start and windows that are supposed to open to display dbase data just say 'Exception in thread "...

How can i debug this SQL error..?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Krul. Good bye!.')' at line 1 I have a LONG script with a lot of loops. It seems to work and then I get thsi error, what does it mean? Update: Oh okay, I see what's wrong. I am storing a var...

Mysql_num_rows() Segfaults

I'm writing a program using C++ and the MySQL C API (version 5.1.31 ubuntu2). However, if the query is UPDATE then I get a Segmentation Fault error when executing the line "RowsReturned = mysql_num_rows( Result );". //this code snippet contains only the relevant code MYSQL_RES *Result; long RowsReturned; MYSQL_RES *MYSQLDB::RunQuery( c...

handling mysql constraint errors

Hi! I tried searching for a solution in this website but I can't seem to find any. I needed to find a way to know which field in my table is causing the constraint error.. In my table, say members table two fields (username,email) are unique keys and defined as unique keys apart from my primary key (memberid). When i add data to this t...

MySQL Rails migration error: "Error on rename of schema_migration (errno: -1)"

Hi there, I'm a PHP dev and I'm new to Rails but have been getting on pretty well, everything seems pretty straightforward. However, up until this morning I have been using SQLite and decided to move what I'm building to MySQL. rake db:create works perfectly, but when I attempt to rake db:migrate I get the following error: rake abort...

monitoring mysql for changes

I have a Java app using a MySQL database through hibernate. The database is really used as persistence layer: The database is read at the initial load of the program, and the records are then maintained in memory. However, we are adding extra complexity, where another process may change the database as well, and it would be nice for t...