mysql

MySQL based web app: Easiest way for users to choose order or items?

I'm working on something where users can rearrange items, and at a later time, those items need to be displayed in the order chosen. As a simple example, consider a list of items: A, B, C, D, E, F, G. The MySQL table would be something simple: user_id, letter, sortnumber The user is allowed to change the order in incremental steps. ...

How can I manipulate MySQL fulltext search relevance to make one field more 'valuable' than another?

Suppose I have two columns, keywords and content. I have a fulltext index across both. I want a row with foo in the keywords to have more relevance than a row with foo in the content. What do I need to do to cause MySQL to weight the matches in keywords higher than those in content? I'm using the "match against" syntax. SOLUTION: Wa...

How to optimize query looking for rows where conditional join rows do not exist?

I've got a table of keywords that I regularly refresh against a remote search API, and I have another table that gets a row each each time I refresh one of the keywords. I use this table to block multiple processes from stepping on each other and refreshing the same keyword, as well as stat collection. So when I spin up my program, it qu...

mysql and php count problem..

i have count problem in php... i create drop down list dynamically from mysql...and what i want is when i select the first drop down menu how can i get the search result count..like 10 products from databse.. look my code.. ajax..file var xmlHttp function showCount(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Yo...

Is it possible to alter a table in mySql via stored procedures?

here's what I'd like to do in mySQL... I'm getting the feeling that this is simply not feasible, but would love to be wrong... create procedure foo(IN MYTABLE varchar(50) , IN COLNAME varchar (50), IN MYTYPE varchar(50)) begin IF (select count(*) from information_schema.columns where table_name =MYTABLE and column_name = COLNAME) = 0 ...

is it possible to call a sql script from a stored procedure in another sql script?

I'd like to use . to call sql script from inside a stored proc like so... delimiter /// create procedure append_procedure() BEGIN \. test.sql; END; /// delimiter ; I'm getting a "failed to open 'test.sql;' " error when I run it this way. I've also tried ! but then I get a permission denied error. However, I can't eliminate the ;...

MySQL Performance

Lately my queries before caching into memcache have been taking forever to process! In this example, it took 10 seconds. All I am trying to do is get the 10 most recent hits in this case. I am getting the feeling that it loads all 125,592 rows then only returns 10, am I right? # User@Host: root[root] @ localhost [] # Query_time: 10 L...

"INSERT IGNORE" vs "INSERT ... ON DUPLICATE KEY UPDATE"

While executing an INSERT statement with many rows, I want to skip duplicate entries that would otherwise cause failure. After some research, my options appear to be the use of either: "ON DUPLICATE KEY UPDATE" which implies an unnecessary update at some cost, or "INSERT IGNORE" which implies an invitation for other kinds of failure...

mysql keyword search

I have a table with names of movies, and I want to be able to search for a movie in that table. But I want to be able to search for part of the title, and still return a result. For example, if there is a record with the name "The quantum of solace", then I want to be able to do a search for "quantum solace", or even "007: quantum solace...

mysql vs mysqli in php

Which is better? Mysl or mysqli? And why? Which should I use? Better - not just in terms of performance, but any other relevant features. Thanks ...

What's the best way to save KML in MySQL?

I have a few maps with certain areas (zones) which I'll want to capture in KML. Within those areas I need to pinpoint addresses. How do I save those maps with its values as efficient as possible to query them later? ...

Images management

Im building a site were users can upload images and then "use" them. What I would like some thoughts and ideas about is how to manage temporary uploads. For example, a user uploads an image but decides not to do anything with it but just leaves the site. I have then either uploaded the file to the server or loaded it to the server memo...

Can you use batches of SQL in mySQL the way you can with SQL Server?

With SQL Server, I can send SELECT * FROM FOO SELECT * FROM BAR to the server and get back the results of both, all in one trip. Can I do that with mySQL also? ...

Beginning jQuery help

I'm trying to make a simple MySQL Admin thing with php and jQuery. I've never used jQuery so my code is probably quite lol-worthy. The problem I'm having with the code is that when I click the button, nothing happens. I know the even fires because if I open the html file in firefox (not going to the url, using the file:/// thing) and cli...

Is JDBC Connection aquiring with MySQL slower than with e.g. Derby ?

I use Tomcat C3p0 (JNDI configured inside Tomcat) MySQL(InnoDB) / Derby(not embedded) as Database EHCache (in Memory) Hibernate Testmachine runs WinXP I used Derby for development and wanted to switch to MySQL. I was surprised to see, that with MySQL my Tests were app. 50% slower than with Derby. My Testscenario : app. 2000 Selec...

mysql, force limited entries in a table

I keep some temporary data in a memory table. I only need the 20 most recent entries and would prefer the data is always be on the heap. How should i accomplish this? i am sure theres nothing i can do about the memory table but how should i handle entries tables? should i add a autoincrease key and delete the oldest whenever i want to pu...

passing variables between flex and php

i am new to flex development my question is How do i pass variables between flex 3 and a mysql database using php? i was told the best way is to AMFPHP but that seems like an over kill or may be not am not sure.. any ideas? ...

How to create multiple game servers?

As the title said, how to create multiple game servers? I am about to develop an online game, and this is my first time. Game play in flash and database things are handled by php and mysql. I have questions about server. After user logged in, they should select a server. How do I create multiple servers for users to select? Is it better...

Security - SQL

Hey, below is a page that handles a login script and I am wondering if I have put it any security holes. I have been reading articles on protecting from injections and others and wanted to make sure that my code is secure. It is submitted via ajax and returns JSON based on the login being correct or not. <?php ob_start(); session_start...

Should I use an ENUM for primary and foreign keys?

An associate has created a schema that uses an ENUM() column for the primary key on a lookup table. The table turns a product code "FB" into it's name "Foo Bar". This primary key is then used as a foreign key elsewhere. And at the moment, the FK is also an ENUM(). I think this is not a good idea. This means that to join these two table...