mysql

Fast data retrieval in MySQL

I have a table of users - It contains around millions of rows (user-id is the primary key). I just want to retrieve user-id and their joining date. Using SELECT user-id, joining-date FROM users requires lot of time. Is there a fast way to query/retrieve the same data from this table? ...

How can I return a whole mysql result set, and one at a time set each row as an array?

foreach($scraperSites as $site) { //$scraperWriter->addSite( new ScraperSite($site) ); print_r($site); } scraperSites is the array of all sites from the mySQL database; I'm trying to keep $site as an array, (but only with one row worth of data), add it to an object, then move on to the next row. ...

I need unusual ordering mysql results

Im trying to order results ASCENDING from the current date this is what im using now; SELECT * FROM friends JOIN bdays ON bdays.user = friends.friendname WHERE username = $userid ORDER BY DATE_FORMAT(date, '%m %d') any ideas? example ordering by date now, sorts the birthdays starting at january what i need, is instead of starting...

graphical relationship map for doctrine/mysql?

i wonder if there is gui tools for creating a graphical map for the relationship between models/objects (doctrine) or tables (mysql)? it would be better than draw it manually. i´ve already have the models/objects and tables created. ...

How does one concatenate database values into a string?

I would like to string together database values into a string. Something like $a "text" $b. And then use the entire string as a variable, let's say $c. Is it better to do this at the database level? Will php use lots of resources to do this? ...

MySQL Workbench vs phpMyAdmin

I've only used phpMyAdmin but then I stumbled upon MySQL Workbench that looks promising. I wonder if someone has tried it out and could give your thoughts about it compared to phpMyAdmin. Could it replace phpMyAdmin completely? ...

Password protect user image album

Hi Im making i photo sharint site I want to give the ability for my users to prevent the public to acces their albums with a password. Then they can give the password to the ones they want to be able to see it. To password protect their albums. Im thinking something like this, cant test it on this computer, should work ok. but as im ...

CodeIgniter Unable to Access Error Message Error

Hi, I've created this registration form for registering new users to a website using CodeIgniter. My problem is, whenever I enter a username that already exists in my database, instead of giving me my error message which explains this to the user, it instead gives me this error message: Unable to access an error message corresponding...

What command is used in mysql to look at the table and give tips?

I seem to remember that there is a command to look at a mysql table and let you know things like maximum size of strings and integers and such so you can optimize the size of your index/table. Do you know what that command is? G-Man ...

How does MySQL's ORDER BY RAND() work?

Hi, I've been doing some research and testing on how to do fast random selection in MySQL. In the process I've faced some unexpected results and now I am not fully sure I know how ORDER BY RAND() really works. I always thought that when you do ORDER BY RAND() on the table, MySQL adds a new column to the table which is filled with rando...

ArgumentOutOfRangeException at MySql execution. (MySqlConnector .NET)

I am getting this exception from a MySqlCommand.ExecuteNonQuery(): Index and length must refer to a location within the string. Parameter name: length The command text is as follows: INSERT INTO accounts (username, password, salt, pin, banned, staff, logged_in, points_a, points_b, points_c, birthday) VALUES ('admi...

Free java or flash file browser for photogallery

Hi. I'm about to develop a small web gallery, where it's supposed to be possible to upload several pictures at a time and then add some info abut the pictures.So I need a free java or flash local file browser that can pass me some info of the pictures that gets uploaded so that I can create some SQL entries for each picture. The platfo...

Primary key in MySQL: INT(n) or UUID as varchar(36)

Does it make sense to use UUID as primary key in MySQL? What would be pros and cons of using UUID instead of regular INT, beside trouble of hand querying? ...

Do I need the text "_size" in the my.cnf file for mysql 5.1?

This is a pretty simple question about setting parameters in the my.cnf file for mysql 5.1. This page gives me the parameters I can tune: http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html and so I think I would need to write key_buffer_size = 256M But when I open my current my.cnf, it has the line: key_buffer = 16M M...

What method should be used for searching this mysql dataset?

I've got a mysql dataset that contains 86 million rows. I need to have a relatively fast search through this data. The data I'll be searching through is all strings. I also need to do partial matches. Now, if I have 'foobar' and search for '%oob%' I know it'll be really slow - it has to look at every row to see if there is a match. ...

mysql database design: thread and reply of a reply?

in my forum i have threads and replies. one thread has multiple replies. but then, a reply can be a reply of an reply (like google wave). because of that a reply has to have a column "reply_id" so it can point to the parent reply. but then, the "top-level" replies (the replies directly under the thread) will have no parent reply. so ho...

Update Mysql database with dataset changings? (C#)

I'm changing my dataset in my program. And when my job was finished, I'm connecting to mysql database. I don't want to do this job again, how can I send changings to database like this mydatadapter.Update(dataset, " table"); I found this code, but I can't run it :S ...

Hierarchical Data in MySQL is as fast as XML to retrieve?

i've got a list of all countries -> states -> cities (-> subcities/villages etc) in a XML file and to retrieve for example a state's all cities it's really quick with XML (using xml parser). i wonder, if i put all this information in mysql, is retrieving a state's all cities as fast as with XML? cause XML is designed to store hierarchic...

php & mySQL: Storing doc, xls, zip, etc. with limited access and archiving

Hi all, In my application, I have a provision for users to upload files like doc, xls, zip, etc. I would like to know how to store these files on my website and have only restricted people access it. I may have a group of people and let only these group access those uploaded files. I know that some may try to just copy the link to the d...

Unable to connect to mysql database using tomcat6 on ubuntu

I am able to deploy the application on my local system.... connecting to the same remote database... however when I deploy the same war file on the ubuntu server I get the following exception javax.servlet.ServletException: Could not connect to wikipedia database... org.wikipedia.miner.service.WikipediaMinerServlet.init(WikipediaMin...