mysql

import bulk data into MySQL

So I'm trying to import some sales data into my MySQL database. The data is originally in the form of a raw CSV file, which my PHP application needs to first process, then save the processed sales data to the database. Initially I was doing individual INSERT queries, which I realized was incredibly inefficient (~6000 queries taking almo...

How can I add "set names 'latin1'" in jasperreports

I have problems with some character display, like "ñ" and accents in my reports, so I want to add previously to the query "set name 'latin1';" but jasper doesn't work, that because when I run the query in phpmyadmin with this line it works. The applicaton in php work fine, don't has a problem with the characters Thanks ...

using references in MYSQL

i got an answer to another question here: http://stackoverflow.com/questions/3094495/db-schema-for-chats/3094915#3094915 it's a great answer, but i am not understanding the bit about references. i can do sql statements but i have never used references. what are they used for? how are they used? give an example please ...

What are the implications of opening MySQL connections over and over again in PHP

Specifically, I have a DB class that opens and closes multiple MySQL connections every time I call the Query function in the class. Should I open a connection once? or is it ok to open and close connections like this? ...

Applying an Index to a Blob/Longtext field

I am trying to create an index on a particular text string using Hibernate annotations. What I am currently doing is: @Index(name="guid_index") @Column(length=1400) private String myGUID; However, since the length of the column is 1400, this maps to SQL using the longtext type. hbm2ddl is able to create the table without mishap, but w...

Query not returning results when a "WHERE" condition is added to it

The query below is not returning any results. I have copied it from a query that was working and the only thing different is the addition of the following condition: WHERE submissionid=$submissionid Any ideas why this query is not returning any results? $sqlStr2 = "SELECT s.loginid ,s.title ...

add a temporary column with a value

I have a select statement like this select field1, field2 from table1 What I want is to have a newfield with only value "example". newfield does not exist in the table, but when I run this query it kinda makes a virtual column with the values of example field. ...

mysql: group by ID, get highest priority per each ID

I have the following mysql table called "pics", with the following fields and sample data: id vehicle_id filename priority 1 45 a.jpg 4 2 45 b.jpg 1 3 56 f.jpg 4 4 67 cc.jpg 4 5 45 kt.jpg 3 6 67 gg.jpg 1 Is it p...

Should I index my sort fields in MySQL

I have a field called 'sort_order' and it's bigint, i use it in my mysql queries for sorting. Is it wise I put an index on it? ...

how can I Limit mysql to single cpu, to allow hardware benchmarking

I have a web application that seems to like to make mysql work hard (cpu wise), as a result i want to establish how the performance of our application scales as we transition to more modern hardware, the current system has 2 cpu, and we could move it onto a grid system, but to find out if this is worthwhile i want to benchmark our applic...

Troublesome coldfusion union query in CFC with mySQL database

This works with a mySQL backend In the form... <cfselect name="to" size="1" bind="cfc:cfcs.messages.getOrganisations()" bindonload="yes" value="organisationID" display="organisationName" required="Yes"> </cfselect> in the cfc <cffunction access="remote" name="getOrganisations" output="false" returntype="query" displayname="G...

SQL query on windows IIS server 2003 breaks with passed variable, jQuery AJAX

Working on a current project I have encountered a strange issue. I have an html page that performs an AJAX call to a php file, passing a variable. The php file creates a SQL query using this variable, generates an XML file, and returns the result. On my webserver this all works fine. However, when moved to a Windows 2003 IIS (permanent ...

How can I move existing data to new row?

I have a table with several thousand rows. I'd like to be able to take one of those rows and duplicate it into a new row. What is the best way to do this? Should I grab the rows data and assign each field into a variable? And then take those variables and insert them into a new row? So that'd be two queries -- is there a more effi...

What is running optimize on a table doing to make such a huge difference?

Simple situation, two column table [ID, TEXT]. The Text column has 1-10 word phrases. 300,000 rows. Running the query: SELECT * FROM row WHERE text LIKE '%word%' ...took 0.1 seconds. Ok. So I created a 2nd column, the table now has: [ID, TEXT2, TEXT2] I made TEXT2 = TEXT (using an UPDATE table SET TEXT2 = TEXT] Then I run the q...

How to update a mysql database via SMS text messaging?

I want to add an additional functionality to a CMS I am making that will allow users to add content to a site via text message. The user should be able to upload an image and add text and send the message to a number which when received will update the database accordingly. Can this be done, and can it be done via PHP because that's th...

MySQL Rating System - Find Rating

I'm trying to rate Types of Fruit by the best possible rating given by users. I have a Fruit table called Ratings just for submitting ratings with the following Information Fruit_id int From_ID int Rating int now I'm trying to run a SQL command like the following select From_ID, AVG(Rating) AS Rating FROM Ratings Group BY `Fruit_ID`...

How to determine if given lat/lon matches stored database lat/lon/range?

I have a MySQL database of promotional codes that are to be displayed to specific users based upon the range of the promo code that is stored in the database. Table example: "promocodes" Columns: id (int), promocode (varchar), lat(decimal), lon(decimal), range (int) The lat/lon columns are the location of a store offering a promo code ...

database suddenly no response after modify process file

hi all..i've a problem my database become no response..i'm using one page process for many form..last time it can works normally,where is my fault: switch(postVar('action')) { case 'newinputdata' : newinputdata(postVar('modelnm'),postVar('serialno'),postVar('faline'),postVar('shift'),postVar('insp_date'),postVar('range_sampl'),p...

MySQL interpreting special characters in generated query

I am trying to migrate the database layer of our framework from SQLServer to MySQL using MySql.data.dll . I have the following generated query in MySQL: select * from `user` where `user_domainname` = 'domain\beth'; MySQL is interpreting the '\b' in the above string as an bell character whereas SqlServer does not interpret any such esc...

alert beep sound new user comes

hello... i am doing private chat concept. i want to alert beep sound when new user comes in. how to do? i am displaying every thing when new user comes in user details will comes at admin side. but at the same i want to alert beep sound when new user comes. ...