mysql

Error connecting java to mysql server after dialing up a modem

I juste installed mysql on my ubuntu box (lycid lynx) and try to connect to mysql trough java. Mysql is configured to allow only local connection. I can connect to mysql server with the mysql client locally and also i can with PHP. But from java no! I get this error "Host '....' is not allowed to connect to Mysql server". The address ip...

I made a website in English, what's the most optimal way to add one more language?

So, I have created a big website (a lot of text in different files and a lot of programming). I need to add one more language, how should I do? What is the fastest way I can add second language and let my visitors to choose between them? Any ideas? Thanks. ...

Count of Sums possibly using group_by

Say you have a user table and an order table which references user (user has_many orders) and contains an item count field. How could you efficiently ask "how many uses ordered how many items?" That is, to generate something along the lines of: Number of users | sum of items ------------------------------- 5 users | 1 item 4 u...

Why use frameworks? Convince me I should figure out Zend Framework and use it!

Possible Duplicate: Why use a framework with PHP? To begin with, I just can say that I have always been programming by my own. I use php mostly. So, can you explain me why I should learn Zend Framework or other framework? Why just don't write a pure code by own? edit: sorry, I really wrote into search input why use framework ...

MYSQL: Copying a table from a snapshot into production

Hi folks, i have a snapshot of the database that I took before i did some data migration. The data migration messed up, so I want to retrieve the data from the snapshot to migrate over to the production database. Question: How do i access the snapshot, and how do i retrieve the available data? Thanks! ...

MySQL - Sort on a calculated value based on two dates

I have the following problem that needs to be solved in a MySQL query: Fields info - textfield date1 - a date field date2 - a date field offset1 - a text field with a number in the first two positions, example "10-High" offset2 - a text field with a number in the first two positions, example "10-High" I need to sort the records by the...

Updating counters through Hibernate

This is an extremely common situation, so I'm expecting a good solution. Basically we need to update counters in our tables. As an example a web page visit: Web_Page -------- Id Url Visit_Count So in hibernate, we might have this code: webPage.setVisitCount(webPage.getVisitCount()+1); The problem there is reads in mysql by defaul...

How to get rank based on SUM's?

I have comments table where everything is stored, and i have to SUM everything and add BEST ANSWER*10. I need rank for whole list, and how to show rank for specified user/ID. Here is the SQL: SELECT m.member_id AS member_id, (SUM(c.vote_value) + SUM(c.best)*10) AS total FROM comments c LEFT JOIN members m ON c.a...

Retrieve object from jquery in php script

I'm trying to rebuild an object encoded with Json but i'm not getting any value. JQuery: $.post("views/insert_tasks.php",{ clickedRows : clickrows , <?php echo "tasks:'" . json_encode($tasks) . "'"; ?> }, function(data) { }); this is the PHPcode to retrieve the object: $tasks = json_decode(stripslashes($_POST['tasks']), true); $t...

Using indexes on/through a MySQL view

We've got a MySQL table in which rows are never updated, but instead new rows are added and the old ones marked obsolete. Think Rails' acts_as_paranoid, but for every update. To make working with Rails sane, we've got a view which selects only the rows which are "current". That makes a much better "table" for our ActiveRecord model. ...

How to get only tables, not views using SHOW TABLES?

SHOW TABLES gives you tables+views. How do I retrieve only tables? ...

MySQL DELETE in a single table

Hi, I have a database with only one table as below: userurltag(id,userID(string),Url(String),tag(String)) I want to delete users that have less than 3 urls associated with them. How can I do that? ...

Symfony generating database from model

Hello, I am having troubles generating a simple database form model. I am using: Doctrine on Symfony 1.4.4 MySQL Workbench 5.2.16 with Doctrine Export 0.4.2dev So my ERL Model is: http://img708.imageshack.us/img708/1716/tmg.png Genereted YAML file: --- detect_relations: true options: collate: utf8_unicode_ci charset: utf8 t...

Basic Login Script using php and mysql inquiry

Attempting to write a check for a login script to see if the username is available. Would the best way to write this query be to check if isset(!_POST[]) for both values (nick and pass) then connect to database WHERE the mysql database for the usernick requested return the user id if the usernick exists evaluate if isset($id) to se...

Re-order mysql rows using PHP

| id | url | title | menu_id | ------+--------+--------+---------- | 1 | http://| link 1 | 1 | | 2 | http://| link 2 | 2 | | 3 | http://| link 3 | 3 | | 4 | http://| link 4 | 4 | Hi, I was wondering if its possible using PHP to reorder the above to something like below. I am trying to generate a men...

Thoughts/Input about Database Design for a CMS

I'm just about to expand the functionality of our own CMS but was thinking of restructuring the database to make it simpler to add/edit data types and values. Currently, the CMS is quite flat - the CMS requires a field in the database for every type of stored value (manually created). The first option that comes to mind is simply a tab...

mysql query timer for .net

Is there something i can use to track how long my mysql queries take? perhaps log them if they take > a certain amount of time? or track all queries but only hold the longest query time? using this with C# .NET with ASP.NET. I'd like to use this to occasionally check if my queries are getting slow. ...

MYSQL: Checking datafile being used from the command line

i am having trouble configuring mysql database to connect to the right file. I do not know which datafile is being used (due to some pretty tricky EC2 related moving around), My question is: from the command line, how do i see what datafile is being used by the mysql database? ...

changing value of a primary key in a table and FK in referenced tables

I wish to change the primary key of a table, and also change the foreign key of the tables that reference it. for example table employee has PK idEmployee = 1 table payroll has FK idEmployee = 1 I want to update employee to idEmployee = 2 and let the table payroll change FK idEmployee automatically. is this posible in mysql? thanks....

Problem with mysql query to replace a string

I've used mysql's update replace function before, but even though I think I'm following the same syntax, I can't get this to work. Here's what I'm trying to do: UPDATE contained_widgets SET preference_values = REPLACE(preference_values, '<li><a_href="/enewsletter"><span class="not-tc">eNewsletter</span></a></li>', '<li><a_href="/en...