mysql

Split functionality in mysql

Hi, I have a column empname in a table, the data stored is Lastname,Firstname. For ex: empname: Martin,Ricky Ford,Henry. How to do i via select mysql query get the o/p as: First name Last name Ricky Martin Henry Ford ...

Network latency under Hibernate/c3p0/MySQL.

I'm connecting to a MySQL (InnoDB) database over a connection with fairly high latency (~80ms) but relatively high bandwidth. I've noticed that query times vary dramatically depending on how the query is issued. In the following examples I'm performing a query for a single, small row by primary key. The query times are: Command line...

Filtering table and then joining results

I'm trying to filter the table collections by id and then join the collections.user_id on users.user_id. Here is the query I've tried SELECT * FROM (SELECT * FROM collections WHERE mid=`$id`) c JOIN users on c.mid = users.user_id ORDER BY users.user_id Haven't managed to get it work obviously. Any help or pointers would be apprec...

Website Security Questions

I am creating a website that is using a perl script, PHP, a MySQL database, and HTML. My main concern is making sure there is not anyway someone can gain access to anything that give them access to my information. I mean is there anyway for someone to get my perl script and see my database information. I know about sql injection but I ha...

Organize Questions & Answers from database in php and mysql

In my database I have questions and answers. Every post has a 'postID' and only answers have a 'responseID', which references the 'postID' of the question. I can identify which answers go to which question since responseID = postID I'd like to write some php code that would display the data in the following format: Question: - answer ...

Any Performance solution for retrieving online status from MySQL database.

Hi Guys; I have a large chat application in the build process and i'm confused about how to solve this issue .. i need to show the online status of 10 users on a page at a given time for which i'm using a database query and every time someone visits the page the query is executed and returns the user who are online ... problem is the on...

How to repair a corrupted MPTT tree (nested set) in the database using SQL?

I have an MPTT tree of over 100,000 records stored in MySQL using lft, rght and parent_id columns. Now the left/right values became corrupted, while the parent ids are still intact. It would require tons of queries to repair it in the application layer. Is there a good way to put the burden on the database and have it recalculate the lef...

How should I insert/update/delete large lists in mysql?

I am trying to figure out the best way to handle inserting/updating/deleting large lists. Specifically, my users need to select large lists of products and they will get reports on those items every night. To oversimplify it, here is the data model (a simple many to many) ~ 5000 records total +----------+------------+ | user_id | us...

Is this sql input validation secure?

I'm currently developing a database class for a project I've been working on. I would like to know if the following function has any holes or errors in it that would allow for someone to use MySQL injection. public function sql_validate($var) { if (is_null($var)) { return NULL; } else if (is_string($var)) { ...

performing calculation in mysql

dear all..i have some data at DB. name Range bla 123x9901-123x0000 //it means range 9901 until 10000 = 100 bla 123v0001-123v0100 // 10001-10100 = 100 i want the result like: name Qty bla 200 i counting them use: SELECT................ IF(RIGHT(Range,4) = "0000",10000,RIGHT(Ra...

share images to facebook account

i want to share images to my website's facebook account when users upload the images, is there is any php code or api to fix this ...

update index in Solr, error: required field in SolrSchema not found in DataConfig

I'm trying to update my index, but I keep on getting the error: org.apache.solr.handler.dataimport.DataImporter verifyWithSchema INFO: UPC is a required field in SolrSchema . But not found in DataConfigfound in DataConfig I can't figure out why it's complainting, since: the first time I ran the import, it worked fine, and t...

Optimizing a high insert/select/delete table

I have a transaction log table that basically is inserting, reading, and writing new records many times a second. It has about 5 rows with various ids in them. Aside from indexes/query modifications, is there anything specific to optimize a table like this? It's a MyISAM table type. Thanks! ...

dolphin community - how to install dolphin community

Can anyone explain how to install dolphin community - since there are lots of parameters to give while in the installation process and I am stuck in between those ...

Is there a very simple front-end for MySQL tables?

Hi, I'm looking for a front-end that's very simple, to access a to-be-built MySQL Database. I actually need it for only one table. I was thinking that the user could search in a way that would ask for values for each field of that table, and give the option of leaving it blank. Then, it would return all the entries that match up with th...

UTF-8 not working in HTML forms

I have this form: <form method="post" enctype="multipart/form-data" accept-charset="UTF-8"> But when I submit an é character, it turns it into é. Why doesn't this work? Yes, the MySQL database has all the character-sets set up correctly. (Database, tables.) If I manually put it in the database with Navicat it shows up fine on the we...

Fastest way get random record from DB

I've been using order by rand() and it's becoming too much of a bottle neck. I've tried this SELECT id FROM users JOIN ( SELECT CEIL( RAND( ) * ( SELECT MAX( id ) FROM users ) ) AS id ) AS r2 USING ( id ) And it would work if all the id's were incremented, however with this particular table, they're not. The id's are fairly rando...

mysql query count per databse

Hi, Im searching a cmdline or any mysql config which can tell me the queries being fired per database. I would check this info frequenty. mysql gives query count but i want it itemized so I can locate which database is more busy more often. Planning to put that code into my munin plugin=chart. thanks, vikas ...

HELP! MySQL Join Many to Many + PHP

Hello everybody! And how to write MySQL Join and PHP? Or you can make another? ... Examples: Table 1: movie_id | movie_title 1______ | title_movie_1 2______ | title_movie_2 3______ | title_movie_3 Table 2: genre_id | genre_title 1______ | title_genre_1 2______ | title_genre_2 3______ | title_genre_3 Table 3: id | movie_id...

PDO cannot compare mysql ENUM using integers in prepared statements

I am using PDO and prepared statements, but i cannot seem to get any results when comparing an ENUM field with an integer. Example: $db = new PDO('mysql:host=localhost;dbname=****', '***', '***'); $s = $db->prepare('SELECT id FROM t2 WHERE lang = ?'); $s->execute(array('en')); // Works print_r($s->fetchAll()); $s->exec...