mysql

MySQL - move from flat table to first normal form

Hello I am building an application that will allow a user to record weekly activity over a 6 week period. Each week has 3 benchmarks to record against, here is an example: Week 1 +------------+-----------+------------+-----------+ | Day | Minutes | Location | Miles | +------------+-----------+------------+-----------+...

MySQL - retrospectively add ID that AUTO_INCREMENTs

I have table with lots of rows, and there is no id column. I'd like to go back and: add an ID column as PRIMARY KEY with AUTO_INCREMENT more importantly, retrospectively add an ID for all the existing rows, from oldest to newest (there is an 'updatetime' column). Any suggestions? ...

mysql query doubt

Hi, my query is as follows: SELECT r.name , r.network , r.namestring , i.name , r.rid , i.id , d.dtime , d.ifInOctets FROM router AS r INNER JOIN interface AS i ON r.rid = i.rid INNER JOIN 1278993600_1_60 AS d ON i.id = d.id AND dtime BETWEEN 1279027200 AND 1279029000 WHERE r.network = "ITPN" AND i.status = "active" WHERE ...

Upload XML feed to mysql using PHP

Hi I have an XML feed coming in: <?xml version="1.0" encoding="UTF-8"?><product> <name>John</name> <contact_email>[email protected]</contact_email> <contact_telephone>01234 567</contact_telephone> <url>www.johnsone.com.com</url></product> I need to get this loaded to MySQL using php - have seen a few examples but all of them take a f...

Finding Orders With One Product And One OTHER Product From Another Category

Let's say I have a database where the relevant portions look like this: PRODUCT TABLE productid categoryid ORDER LINE ITEMS TABLE orderid productid Let us also say that productid #1 is in category #1. My goal is to find all orders that have BOTH a line item any product in categoryid #2 AND productid #1 (which is not in catego...

How to stop someone from going back to previous page?

I am working on a my site to allow users to take test so they can see how much they know of a particular subject. I am running into a little problem though. Once a user submits the test for grading, how do I prevent them from going back to the test page? I am on a Mac with Safari running and when I click the back button in my web browser...

mysql query browser: is it possible to undo change?

ive updated a table in a database using mysql query browser. is it possible to roll back? ...

problems while executing a sql command in vb

I have a problem with a sql query. Through the query I am trying to search database for any occurrences of string (can be anything) in a column using the SQL LIKE command. The problem is that it works fine for most of the strings say john, jim, ji"m , but does not work when i include the following characters which are ( ' , { , } , and a...

mysql: or/and question

is this: update batchinfo set instrument='Instrument 17' where datapath like '%10497%' or datapath like '%10506%' or datapath like '%10516%' or datapath like '%11081%' and instrument='Instrument 1' the same as this: update batchinfo set instrument='Instrument 17' where datapath like '%10497%' and instrument='Instrument 1' or dat...

How to show 5 records in 5 different <DIV > tags using jquery PHP Mysql with Next /prev button

Hi, I have html page whicha has 5 Div tags in disable mode. what I want is Imagine I have 200 records in mysql database table Using Jquery I want to call PHP Mysql data (only 5 records at a time) When user clicks on Next button PHP page will get called Limit 6, 10 and so on if user clicks on Prev button then previous 5 records ...

Database access related info on clustered environment

My understanding of database cluster is less because I have not worked on them. I have the below question. Database cluster has two instance db server 1 & server 2. Each instance will have a copy of databases, considering the database has say Table A. Normally a query request will be done by only one of the servers which is randomly de...

Hibernate, c3p0, and Mysql: the java.io.EOFException

Hello, I'm using Hibernate with MySQL and c3p0, and when the MySQL connection expires after 8 hours (wait_timeout), Hibernate is unable to reconnect and i get the following exception: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException ST...

MySQL Query : Select existing months from database and complete dynamically with the rest of year's month

Hi all, I have two tables: CREATE TABLE 'sales_sheet' ( `_id` int(11) NOT NULL AUTO_INCREMENT, `_typed_by` int(11) DEFAULT NULL, `_product_id` int(11) DEFAULT NULL, `_year` date DEFAULT NULL, `_validation_state` int(11) DEFAULT NULL, PRIMARY KEY (`_id`), KEY `_product_id` (`_product_id`) ) ENGINE=MyISAM DEFAULT CHARSET...

duplicate mails sent after 24 hr from jboss

Hye everybody I encountered a problem in my application and finding now way around. I had made an service to run on jboss middleware server with a cron scheldule for executing at 8 pm everyday which is like this 0 0 20 * * ? and the service get started normally the java code for the service also worked well when executed as java app by ...

Extract a mysql resource to php array?

My goal is to display the profile of a user. I have this function: function get_profile($un) { if($registerquery = $this->conn->query("SELECT * FROM table WHERE usr = '".$un."' ")){ return $profile = mysql_fetch_array($registerquery); } } Then the display snippet: <?php $profile = $mysql...

MySQL - How to get NULL if equality does not exist

CREATE TABLE Customer( customer_id INT NOT NULL, first_name VARCHAR(20), last_name VARCHAR(20), PRIMARY KEY (customer_id) ); CREATE TABLE Payment( customer_id NOT NULL, year YEAR, payment_amount INT, FOREIGN KEY (customer_id) REFERENCES Customer(customer_id) ); Here is the query I am using: SELECT Customer.fi...

MySQL - moving from 1st Normal Form to 2nd and 3rd Normal Forms

Hello This question directly relates to a previous topic "MySQL - move from flat table to first normal form" (http://bit.ly/9pvS0Y) - and as I am now asking a question about moving to second and third normal forms, I figured it best to start a new topic. Below is my first normal form schema which I am pretty sure is solid enough for my...

Why is table-level locking better than row-level locking for large tables?

According to the MySQL manual: For large tables, table locking is often better than row locking, Why is this? I would presume that row-level locking is better because when you lock on a larger table, you're locking more data. ...

Python and mySQLdb error: OperationalError: (1054, "Unknown column in 'where clause'")

Hey all, I'm getting an error OperationalError: (1054, "Unknown column 'XX' in 'where clause'") Where XX is the value of CLASS in the following code conn = MySQLdb.connect(host = "localhost",user = "user", passwd = "pass",db = "dbase") cursor = conn.cursor() cursor.execute("""SELECT * FROM %s WHERE course =%s AND sec = %s""" % (s...

Joining new columns in MySQL One-To-Many

I asked a similar question the other day but it seems no one was able to answer it, and searched the internet for a few days but still fruitless, perhaps I am not asking the question the right way: http://stackoverflow.com/questions/3444718/one-to-many-query-in-mysql So I while try again and maybe word it a bit differently. This is ess...