mysql

Is "VARCHAR(255) CHARACTER SET utf8" 255 bytes or 255 characters.

I've declared a field in my INNODB/MySQL table as VARCHAR(255) CHARACTER SET utf8 NOT NULL however when inserting my data is truncated at 255 bytes not characters. This might chop the trailing two bite code point i*emphasized text*n two leaving an invalid character. Any ideas what I might be doing wrong EDIT: A sample session is l...

Problem with mysql2 and rails3 (bundler)

Hello, I get this error `establish_connection': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError) from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord- Here is dump of whole error and my config ...

.net installer to add mysql database tables on install

Hi, I am getting to a point now with my program where by i am writing the .net installer to install it in the right location etc. my question is, is there a way that when i run the installer i can also add database tables to a mysql database? or should i write a seperate program to run after install which checks the db and adds the t...

Why does my mysql_real_escape_string not work(PHP) ?

hello, I have read many about SQL-Injection". But it does not work with this code: $inputform= $_GET["password"]; $query = "INSERT INTO user(password) VALUES ('".mysql_real_escape_string($inputform)."')"; For example I use this example: O'Conner. When I submit it and look in my table there is O'Connor and not O\'Conner. thanks ...

How to show MYSQL statements that show how to create a particular table?

Hi, I've created and edited a couple of tables and don't want to recreate them from scratch if the database gets erased. What command allows me to "export" the field names and settings (NOT the content) as a ready to use MYSQL command that I can paste back on the MYSQL prompt? ...

sql: select not in...

how can I rewrite the following query using JOIN SELECT * FROM table1 WHERE id NOT IN ( SELECT t1Id FROM table2 ); ...

Connecting to remote MySQL problems...

Hi, Having a bit of a problem with mysql... Mysql 5.1 on windows 2008 server iis7 Site on windows 2003 server iis6 [sorry but can't move to linux kids! ;)] In the process of shifting a site to a new server so I have moved the database 1st and connected the site to the new database. I tested the connection before moving but now the si...

Populate dropdown menu based on groupnumber and MySQL answer

Hello! I am building an webapplication for retailers to register purchased products in PHP/MySQL. What I like to do now is to populate a dropdown menu in a form with the products the specific retailer sells. The retailer is assigned a value for each product that they are selling, and then the values are summed up and putten into the data...

mysqlrepair --all-databases AND specific table? Or, What is the best way to be checking/repairing MySQL tables frequently?

A server has multiple mysql databases with identical schemas. There is a single table within each database that tends to crash and require repairing. We would like to run something like below on a cron. mysqlrepair --auto-repair --all-databases --force --silent For a single table (not large in size) in ~100 databases, Reading http://...

Rounding a MYSQL datetime to earliest 15 minute interval in milliseconds (PHP)

Hi, I'm fetching a datetime from MYSQL which looks like: 2010-08-11 11:18:28 I need to convert it into the "floor" or the earliest 15 minute interval and output in milliseconds for another function. So, this case would be: 2010-08-11 11:15:00 in milliseconds Whoops! Sorry - need to clarify - I need code that will transform it int...

MINUS two Tables based on 2 columns

Hi All, I need to SELECT the rows of 'billing_temp' that doesn't exist in 'billing' based on two columns. Currently I come-up with this query: SELECT ControlNum, CarrierName, PhoneNum, PatientName, SubscriberID, SubscriberName, ChartNum, DoB, SubscriberEmp, VisitID, ServiceDate, ProviderName, CPTCode, BillingDate, AgingDa...

Custom CMS with multiple users. Best practices

Hi, I'm currently developing a web application for a particular niche. The point is that users can create an account, manage specific data and use that data on their website through API calls. So it's actually some sort of WordPress CMS but without the front end functionality. It is also not open source. So in short, user can manage th...

group range fields in mysql?

Is it possible to adapt this mysql statement: $sql = "SELECT u.user_registered, u.first, u.last, c.class_grade FROM users u JOIN classes c on c.class_id = u.class_id and WHERE user_registered >= '". $from . "' and user_registered < '". $...

Having a problem with a basic join

I have a table called tblSport which contains the columns pkSportID and fldName. I have a table called tblRespondentSport which contains the columns fkRespondentID and fkSportID. I want to return the sport ID, the name of the sport, and the number of respondents. Here's my query: SELECT s.pkSportID AS id, s.fldSport AS sport, r.COUNT(...

grouping problem in sql

Cant get my head round the sql for a leaderboard part of a facebook app I'm developing. The idea is, a list of peoples friends is passed in the WHERE clause (i.e 2,1,3,4 would be ID's of someones friends) therefore the leaderboard is a list of someones friends including themselves. I want the top score for every fb_id and want it in de...

Return all columns belonging to a record in a key value table when matching multiple values

Hi I'm trying to do what seems simple, but my SQL skills are limited :) I have one table in MySQL containing key value pairs like this: ID | Record_ID | Key | Value 1 | 1 | type | person 2 | 1 | name | Henrik 3 | 1 | skills | Not any sql skills 4 | 1 ...

How can I avoid separating the search query to search a MySQL database?

When a user tries to search for people on our system, we've noticed that they often type a full name for their search. How can we enable full name searching on our database when first name and last name are stored in different columns? ...

JSP: execution non-English chars in mysql query

I wrote a JSP code that needs to run some mysql INSERT queries that contains non-English chars (Persian). I run two types of queries first one is static application installation queries and second one is user inputs. After execution of both of queries non-English chars are imported as "?" as I check them in application itself and phpMyAd...

mysql query - contains?

how can i search for a particular string in mysql? I tried using contains- gives me error: SELECT r.name , r.network , r.namestring , i.name , r.rid , i.id , d.dtime , d.ifInOctets , d.description FROM router AS r INNER JOIN interface AS i ON r.rid = i.rid INNER JOIN 1278993600_1_60 AS d ON i.id =...

MySQL INSERT - SELECT syntax problem!

INSERT IGNORE INTO table3 (id1, id2) VALUES SELECT id1, id2 FROM table1, table2; What's wrong with the above SQL query? It shows me syntax error. ...