mysql

How to find similar results and sort by similarity?

How do I query for records ordered by similarity? Eg. searching for "Stock Overflow" would return Stack Overflow SharePoint Overflow Math Overflow Politic Overflow VFX Overflow Eg. searching for "LO" would return: pabLO picasso michelangeLO jackson polLOck What I need help with: Using a search engine to index & search a MySQ...

Speed up forum conversion

I'm converting a forum from myBB to IPBoard (the conversion is done through a PHP script), however I have over 4 million posts that need to be converted, and it will take about 10 hours at the current rate. I basically have unlimited RAM and CPU, what I want to know is how can I speed this process up? Is there a way I can allocate a huge...

How do I build libmySQL ?

I aim to integrate libmySQL into my executable instead of using libmySQL.dll. I use VC++ 2008 @ Windows Vista. I've downloaded "mysql-connector-c-noinstall-6.0.2-win32-vs2005.zip" from http://dev.mysql.com/downloads/connector/c/ It contains only ".h" files with declarations. Where is the implementation code (".c" files)? As said, I wi...

Loop in MySql, or alternative?

I have a MySql db with innoDB tables. Very simplified this is how two tables are layed out: Table A: controlID(PK) controlText Table B: controlOptionID(pk) controlID(FK to table A) controlOptionType controlOptionValue So many controlOptions(table B) can reference one control(giving that control m...

Ordering by two fields

Hello, The input below sorts submissions by a timestamp field called "datesubmitted" in reverse chronological order. This field is in a MySQL table called "submission." Another MySQL table "comment" has another timestamp field called "datecommented." Each submission has only one "datesubmitted" but it could have several comments, e...

PHP mySql update works fine on localhost but not when live

I have a a php page which updates a mySql database it works fine on my mac (localhost using mamp) I made a check if its the connection but it appears to be that there is a connection <?php require_once('connection.php'); ?> <?php $id = $_GET['id']; $collumn = $_GET['collumn']; $val = $_GET['val']; // checking if there is a ...

SQL Load Data Special Characters

I'm trying to import data into SQL from a CSV in PHP My Admin so it may be a PHP My Admin problem. The problem i'm having is that some of the columns use special characters for instance: "Adán, Antonio" Ends up as just "Ad". The column structure is as follows: CREATE TABLE IF NOT EXISTS `players` ( `player_name` varchar(255) COLLA...

onbeforeprint() and onafterprint() equivalent for non IE browsers (PHP, MySQL, JavaScript, HTML)

Hi all, I want to send some info back to my database when a user prints a certain web page. I can do this in IE with onbeforeprint() and onafterprint() but I would like to browser agnostic way of doing the same thing. Don't care which combination of technologies I have to use (PHP, MySQL, JavaScript, HTML) so long as it gets done. Any...

mysql import vertical csv data

I have a spreadsheet that is currently formatted improperly for a mysql import. The data are organized by column rather than by row. So, the first column has the field names, the second column contains record 1, and so on. Is it possible for mysql to understand this data? If not, any ideas on how to import these data besides redoing the...

Left Join not working (MySQL)

I have a table Books, where I store Book data (ISBN's, Titles, Authors, etc.). To tell which books are editions of each other I have a field Edition_Group_ISBN, which is an arbitrary ISBN from the group. I'm having trouble getting this query, which is supposed to give the Book data and the number of other Editions based on the ISBN, to...

Mysql assigning default causes error

Hi, I am trying to run the below query to create a table in mysql and I am getting an error. create table newtable ( version_id int(11) auto_increment not null, test_id int(11) default version_id, primary key(version_id) ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corr...

Initial User Password Import to MYSQL

I inherited a site with a with a large user base. My client is updating their records and I need to import some predetermined passwords for about 900 users into a mysql table. The row that I am importing to seems to encrypt the passwords if I enter them through the php front end. I can get all of the passwords to import into the table us...

MySQL Query - SELECT (average of a category) AS "CATEGORY AVERAGE"

Objective: When user browses to a particular seller, then display his average along with the average of sellers from similar category for easy comparison. Example Data: Seller | Category | Qty | Sales -------------------------------------------- Harry | Mango | 100 | 50000 John | Apple | 75 | 50500 Max | Ma...

PHP MySQL select random rows

Hi, I have a problem selecting 6 random friends This is the query I've got so far: $result = num_rows("SELECT * FROM friends WHERE member_id = '".$_SESSION['userid']."'"); if($result >= 6) { $f_num = 6; } else { $f_num = $result; } for($i = 1; $i <= $f_num; $i++) { $q_get_member_friends = mysql_query("SELECT * FROM frie...

Ruby on Rails add_column does not add that column to existing rows

I have created this migration in Rails: class AddSocialSecurityNumberToContactTable < ActiveRecord::Migration def self.up add_column :contacts, :ss_number, :string end def self.down remove_column :contacts, :ss_number end end In my development database, which is a SQLite3 database, all the old Contact records gained t...

Tough Mysql Query....

Hi guys. I got a skill test for a quick mysql query. I am given the tables: Orders OrderItems ---------------------------------------- id id date order_id(Orders.id) shipping_amount product_id order_status pr...

Determine position of first occurence of string in MySQL?

For a table like this: username | time --------------------------------------- animuson | 0.678 aP*animuson | 0.967 animuson | 0.567 qykumsoy | 0.876 I'm trying to find a way in MySQL to order these by times and then find the position where username occurs and username is only counted once. So, if I'm s...

MySQL triggers alteration

Is there any way how to update automatically mysql trigger(s) structure, every time when I alter a table? ...

Im going crazy [syntax error]

I cant beleive im having this problem... I've been looking and looking but i cant find see whats wrong. I hate this error message. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' poster_ip, message, posted, thread_id INTO posts ' at line 1 mysql_q...

Filtering out MySQL query in PHP

Hey there, I'm doing some queries to a MySQL database that involves some user-input.. And I was wondering how to prevent injection attacks, like, for example, if someone were to type "; a-MySQL query here;" It would be executed, this would allow people access to compromise my system. I'm wondering how i could protect against things l...