mysql

using php, how would I convert all rows of a char field such as "11/19/10" to a date field?

In order to import a column of dates into mysql using phpmyadmin, I defined the field as a char field. So now the dates are in a mysql table look like this: ID | Name | DateArriving 1 | bill | 11/19/10 2 | tom | 12/1/10 etc.... I want the DateArriving field to be formated as actual dates so I can do certain queries such as "who ...

Visual Studio 2008 sql query syntax; drop the brackets

Is there a way to configure VS2008 so that it does NOT create SQL query strings with square brackets in my ASP .Net projects? I'm using a MySQL DB which doesn't like the brackets. Thanks. ...

How do you merge tags on an already existing system

We have a simple interface to tag a particular question (e.g. entry has 1..many tags and each tag entry has a foriegn key pointer back to the entry table) 1. What is the current production version of the jdk? (Tags: jdk6 jdk-6 jdk java) 2. In what version was java.util.spi package introduced? (Tags: jdk-6, jdk7, jdk5) 3. Whic...

How to identify fields from different tables with the same name in a JOIN query result?

Hi there, I'm running a query in MYSQL using LEFT JOIN to get users and their user groups. Both tables have columns named id. My result is being returned in an array (PHP) so that I have one array with all field data, but also only one array["id"]. Here's my query so far: SELECT usr.id, usg.id FROM users usr LEFT JOIN (user_gro...

PHP / MySql report using distinct and group?

I am trying to write a PHP report for a MySql table however I am a bit stuck on the correct commands I should be looking in to... The table structure is as follows: | Int | employeeID | lessonID | date | 1 | 15110 | 50 | 2010-10-18 | 2 | 15110 | 51 | 2010-10-18 | 3 | 15110 ...

changes are not being reflected in when getting the result after insert thru hibernate

Hi, I am using hibernate and spring mvc, when i insert a record in DB, and try to access that that right after that, then i don't get the result. e.g. if insert a record for newly reg. user and login in him right after registering it then result set is empty. I am using hibernate templates. what could be the problem and what i am m...

pass mysql datatable name in autocomplete jsonp

Hi, I am using jQuery UI autocomplete and I am relatively new to jQuery and JSON. Below is my code. I was wondering if it is possible to specify the field name and data table name inside the callback url so that the php file grabs it later. I have many input box with different names and ids which need to have autocomplete. Each input box...

Should I rebuild my PHP website with a document database in order to improve performance?

Hello, We have a website developed in PHP with MySQL and sometimes facing problems when traffic increases. We have almost optimized the site in all ways to handle more requests but still facing problems at peak hours. One of my friends suggests to rebuild the site using HBase / MongoDB as back-end to improve the performance. Also he su...

Can the Sequel Gem connect to MySQL over SSL

Hi Does anyone have any information on how to connect from the sequel gem to a remote mysql database over ssl? I can connect without ssl but trying to connect as a user who requires ssl just fails with the error message: Sequel::DatabaseConnectionError: Mysql::Error Access denied for user 'ssl_user'@'<IP_ADDRESS>' (using password: YES...

MySQL - How to use fields in 'LIKE' operator

Hi! I want to do a 'select' in MySQL using the operator 'LIKE'. But I do not want to use text as a comparison factor. I want to compare text between two fields in same table, like this: SELECT field1,field2 FROM table WHERE field2 LIKE %field1% ; Is it possible? ...

mysql query, optimisation, speed up

Hi, how optimisation mysql query? Now I use Limit function, don't use *. how else can I speed up the operation? Thanks ...

Apply the unique constraint to combinations of columns in SQL

Hi, I have a table called product_attributes in a MySQL Database. It consists of a product SKU (foreign key), an attribute label and an attribute value. I need to ensure that combinations of SKU and attribute labels are unique. EXAMPLE - inserting this would be legal {001, 'weight', '100 lbs'} {001, 'color', 'blue'} {002, 'weight'...

php mysql script gone wrong. please help

Hi guys im hoping someone can help, im working on a site and created this experimental script whitch populates a category menu dynamically based on the database entry it worked for a day and then suddenly stopped. i changed my includes for requires and it gave me this error message Fatal error: Maximum execution time of 30 seconds exc...

How to loop inside loops?

I have 2 table. Table1 "Order" orderid - customer_id 1001 - 1234 Table2 "Items" no - orderid - items_code 1 - 1001 - 100 2 - 1001 - 200 3 - 1001 - 300 how to get results as below (in php): Order # Items Customer ID _________________________________________ 1001 100, 200, 300 1234 ______________________...

Multiple rows, one query

Let's say I have the following table, called GPAs: name | semester | GPA Joe Winter 3.5 Joe Spring 4.0 How can I return the following in one query? name | gpaWinter | gpaSpring Joe 3.5 4.0 ...

MySQL - working out the AVG for a subset of MAX values

Hi all, I have a table with columns 'Date, Name, Score'. I wish to get the MAX(Score) for rows which share a common value (for e.g. the same date or even name), before averaging them to give me a figure, for example: ---- Date -----| -- Name -- | Score 2010-10-10 | John Smith | 86 2010-06-05 | Tedi Jones | 71 2010-10-10 | John Smith |...

return IDs that have ALL of a list of correpsonding values

I have table with 2 columns .... id id2 1 1 1 2 1 3 2 1 2 2 2 4 3 2 3 3 3 4 I want to return the ids which have for example id2 in (1, 2, 4) but that has all of the values in the list. In this above case it would return id = 2. Is this possible? ...

passing uploaded files to another part of the script for onward processing

Hello guys, I have searched the forum but the closest question which is about the control stream did not help or i did not understand so i want to ask a different question. I have an html form which uploads multiples files to a directory. The upload manager that handles the upload resides in the same script with a different code which I...

How to get average tax rates with SQL from a one-to-many relationship

I have a database containing two tables - one, states, contains info about each state's income taxes, and the second, brackets, contains the tax brackets for each state connected to States by a numeric key. I would like to use SQL to retrieve each state and the AVERAGE tax bracket amount for each state to output in a recordset. For exam...

JSF Encode UTF - 8 ?

Hello All , now i work with my friend , he is Vietnamese and he want create website with Vietnamese Language, but we have problem with Encode UTF 8 i was write class Filter follow: import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletExc...