mysql

Problems using uppercase names for MySQL columns with Hibernate mapping classes

I want fix problems with uppercase names on a MySQL column of with Hibernate mapping classes. Is there a rule for use these kind of tables with Hibernate? ...

mysql short union

I'm far from being a mysql guru, so need to know if there's a way to make this query faster,shorter and more compact. (SELECT DISTINCT(cfrm.nid), f.filename, n.title, n.created FROM content_field_raamatu_marksonad cfrm LEFT JOIN node n ON (n.nid = cfrm.nid) LEFT JOIN content_field_kaanepilt cfk ON (cfk.nid = n.nid) LEFT JOIN ...

how to insert xml into mysql from a script?

Hi!! bit of a curly one here let me know if you have any ideas.. For various reasons I need to store a small number of medium size xml documents in mysql (yes I know that technically violates 1NF). I want to script this load so I can drop-recreate the database, and also for my release scripts, however the catch is that the prod release ...

Select Statement For my Question

I have 10 fields in my table but i need 8 fields when i select , i dont want to specify select 1,2,3,4,5,6,7,8 from........ , Any easy way to get the 8 fields (Other hand i dont want to select primary,unique key fields) ...

PHP MySQL Date diff

I have the field datetime with DATETIME type in MySQL. In PHP script I set date begin and date end like this: 11/12/1999 and 11/12/2001. In my table datetime saved in the next format: 11.11.1888 00:00:00. How can I compare these dates? Thanks. ...

get data from datetime's column

lets say I have a "Datetime" column in DB. It has a data like "2010-10-01 09:12:00". Beside that, i want to make a searching page which have: <select id="month" name="month"> <option value="01">01</option> <option value="02">02</option> ... </select> <input type="text" id="year" name="year"> How do i do to get dat...

Java never recieves data from mysql

Hi Lately i have been having some trouble with connecting to mysql from java. Mostly everything works fine. But sometimes, the query takes forever, it is a pretty hard query and it should take about 10s. But it takes minutes without java recieveing the result from mysql. When i look in the processlist of mysql, it is sending data and blo...

Ibatis queryWithRowHandler() still seems to fetch all rows

I'm using Ibatis 2.3.4 and Mysql 5.1.37, with mysql-java-connector 5.1.6 with java 1.6 I have query that returns very many rows from a single table. In order to do this the manual suggests to use queryWithRowHandler(). However when I call this query it internally still seems to fetch all rows (memory goes up very fast before the first h...

How to update column with null value

I am using mysql and need to update a column with a null value. I have tried this many different ways and the best I have gotten is an empty string. Is there a special syntax to do this? ...

MYSQL join 2 tables

Hi, TABLE1 ID | NAME 1 | a 2 | b 3 | c 4 | d TABLE2 ID | TBL1_ID | NAME 1 | 2 | x 2 | 2 | y 3 | 2 | z I would like to join two tables to get all records from table 1 and all records joined from table 2 on ID This query return only all rows from 1 table and 1 row from second table....

Would Singleton be a good design pattern for a microblogging site?

I had not done with any OO in the past in projects, as I kept it simpler (in fact using archaic mysql_query calls and my own filtering) so I wanted to start a new project, learning to use design patterns with my OO along the way. I was looking to build a microblogging site for kicks, and found the Singleton design pattern class which se...

mysql - php . How to find

i have 2 table users : id , name order : id , price, user_id a users have more than one order. And i want to select a users who have total price >100 . how to do ? EX : user John have 3 orders with price : 30$, 40$ , 50$ SELECT * FROM user u INNER JOIN order o ON o.user_id = u.id WHERE sum(o.price) >100 this query will get the...

PHP select row from db where ID is found in group of IDs

I have 3 employers IDs: 1, 2 and 3. I am generating tasks for each one by adding a line in database and in column "for_emp" I insert IDs I want to assign this task for and could be all 3 of them separated by comma. So let's say I got a task and "for_emp" is "1,2,3", the employers IDs. If I would like to select all tasks for the ID 2, wil...

Import database from mysql server 5.0

I have created one database in mysql server 5.0.How i can import this database(I have created the database using mysql command Line) ...

JPA query exception

Hello ! I have a query builded with EntityManager: Query q = em .createQuery("SELECT * FROM :table WHERE username = :username AND password = MD5(:password)") .setParameter("table", User.class.getName()) .setParameter("username", txtLogin.getText()) .setParameter("password", passPassword.getPassword()) ; User user = (Us...

updating a field based on relationship between 2 mysql tables

Hi I have 2 mysql tables woith the following: table_a id, retailer_message, logos_id logos id, name table_a has a retailer_message field, with records such as 'On sale at Amazon' logos table has records with the name field as 'Amazon' for example. Now what I want to do, is update the table_a logos_id based on the relationship with...

asp - mysql not updating records

Dim prestaDB prestaDB = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql50-64.wc1;PORT=3306;DATABASE=example_db;USER=example_user;PASSWORD=example_password;OPTION=3;" set conn = Server.CreateObject("ADODB.Connection") conn.open prestaDB conn.execute("update ps_product set quantity = " & sSeg(4) & " where reference = '%" & sSeg(0) &"%'")...

A simple Wordpress widget: MySQL Error

I'm trying to create a widget for Wordpress. The widget displays the records from the database. function.php in themes/vigilance/ : if (function_exists('register_sidebar_widget')) { register_sidebar_widget('TwiMoldova','twimoldova'); } function twimoldova() { include('widgets/twimoldova.php'); } themes/vigilance/widgets/twimo...

Whats a simple/quick file-upload script programmed in PHP?

I am making a website which gives the user the privilege of uploading a text document to the server. The server then should take the file and store it in the ftp server when it is uploaded and the SQL database should hold the data associated with the file. ...

What kind of code is this?

I have some coded strings in my database which reference the categories of my site. They look like this a:1:{i:0;s:12:"TVRFNE1EYz0=";} I'm wondering what they are so I can create them all to use in a CSV file as creating them on my site is very time consuming. Thanks Oh actually I really don't think this is possible. It happens whe...