mysql

is it better to query database or grab from file? php & mysql

I am keeping a large amount of words in a database that I want to match up articles to. I was thinking that it would just be better to keep these words in an array and grab that array whenever needed instead of querying the database every time (since the words won't be changing that much). Is there much performance difference in doing...

CodeIgniter: Storing an image in the database?

Hello, I would like to store images in my mySQL database using the CodeIgniter PHP framework. How do I write and read the image? Thank you. ...

Easy way to compute how close an auto_increment is to its maximum value?

So yesterday we had a table that has an auto_increment PK for a smallint that reached its maximum. We had to alter the table on an emergency basis, which is definitely not how we like to roll. Is there an easy way to report on how close each auto_increment field that we use is to its maximum? The best way I can think of is to do a SHO...

Should user preferences be included in the users table?

I'm creating a members site, and I'm currently working on the user Preference settings. Should I create a table with all the preference fields (about 17 fields) or should I include them in the main member table along with the account settings? Is there a limit as to how many fields I should have in a table? currently the member table ha...

C# and MySQL .NET Connector - Any way of preventing SQL Injection attacks in a generic class?

My idea is to create some generic classes for Insert/Update/Select via a C# (3.5) Winforms app talking with a MySQL database via MySQL .NET Connector 6.2.2. For example: public void Insert(string strSQL) { if (this.OpenConnection() == true) { MySqlCommand cmd = new MySqlCommand(strSQL, connection); cmd.ExecuteNonQue...

How do you store accented characters coming from a web service into a database?

I have the following word that I fetch via a web service: André From Python, the value looks like: "Andr\u00c3\u00a9". The input is then decoded using json.loads: >>> import json >>> json.loads('{"name":"Andr\\u00c3\\u00a9"}') >>> {u'name': u'Andr\xc3\xa9'} When I store the above in a utf8 MySQL database, the data is stored like the...

Efficiently fetching and storing tweets from a few hundred twitter profiles?

The site I'm working on needs to fetch the tweets from 150-300 people, store them locally, and then list them on the front page. The profiles sit in groups. The pages will be showing the last 20 tweets (or 21-40, etc) by date, group of profiles, single profile, search, or "subject" (which is sort of a different group.. I think..) a ...

Getting random values in mySql query

I have a query which selects 6 names in the database. eg SELECT names FROM users LIMIT 6 Now I want this query to select a random 6 names in the database table, is this possible? And how ...

Top x rows and group by (again)

Hello, I know it's a frequent question but I just can't figure it out and the examples I found didn't helped. What I learned, the best strategy is to try to find the top and bottom values of the top range and then select the rest, but implementing is a bit tricky. Example table: id | title | group_id | votes I'd like to get the to...

paging php error - undefined index

i've a search form with paging. when the user enters the keyword initially, it works fine and displays the required output; however, it also shows this error: Notice: Undefined index: page in C:\Users\user\Documents\Projects\Pro\search.php on line 21 Call Stack: 0.0011 372344 1. {main}() C:\Users\user\Documents\Projects\Pro\search.php:0...

MYSQL Event to update another database table

Hey All, I have just taken over a project for a client and the database schema is in a total mess. I would like to rename a load of fields make it a relationship database. But doing this will be a painstaking process as they have an API running of it also. So the idea would be to create a new database and start re-writing the code to u...

How to return result set based on other rows

I've 2 tables - packages and items. Items table contains all items belonging to the packages along with location information. Like following sample tables: Packages table id, type(enum{general,special}) 1, general 2, special Items table id, package_id, location 1, 1, America 2, 1, Europe 3, 2, Europe Question: I want to find all 'sp...

Stored Queries?

Is it considered crazy to store common SQL queries for my web app in a database for use in execution? Or is that common practice? Or is it impossible? My thinking is, this way, I avoid hard-coding SQL into my application files, and add another level of abstraction. Is this crazy? Is this what a stored procedure is? Or is that somethin...

Open Source - EER Modeling Tool

Is there a good open source or reasonably priced EER modeling tool for MySQL besides MySQL Workbench? I find the MySQL Workbench interface to be clunky. I would like to be able to manage my production schema beginning all design changes in the EER and propogating those out to my schema for created and altered tables. Is anyone use a to...

Fulltext search for django : Mysql not so bad ? (vs sphinx, xapian)

I am studying fulltext search engines for django. It must be simple to install, fast indexing, fast index update, not blocking while indexing, fast search. After reading many web pages, I put in short list : Mysql MYISAM fulltext, djapian/python-xapian, and django-sphinx I did not choose lucene because it seems complex, nor haystack as ...

php populate listbox dynamically without submitting form

Hi Everyone, I'll try to explain this as best as I can. I have a form that accepts multiple fields, and in the end, e-mails all the fields to a specific e-mail address. So for example, I have three text boxes, one list box and two submit buttons. Two of the text boxes are first name, and e-mail address The third text box is used to p...

Checking if a boolean column is true in MySQL/Rails

Rails and MySQL: I have a table with several boolean columns representing tags. I want to find all the rows for which a specific one of these columns is 'true' (or I guess in the case of MySQL, '1'). I have the following code in my view. @tag = params[:tag] @supplies = Supply.find(:all, :conditions=>["? IS NOT NULL and ? !=''", @ta...

why does entity framework+mysql provider enumeration returns partial results with no exceptions

I'm trying to make sense of a situation I have using entity framework on .net 3.5 sp1 + MySQL 6.1.2.0 as the provider. It involves the following code: Response.Write("Products: " + plist.Count() + "<br />"); var total = 0; foreach (var p in plist) { //... some actions total++; //... other actions } Response.Write("Total Products Che...

LAMP stack on home computer as a public web server

So I'm using this website: http://www.howtoforge.com/ubuntu_debian_lamp_server to setup LAMP on my Ubuntu Virtual Machine. Here is my question though, This will enable me to program and test through localhost. How can I set this up so anyone on the web can access my .php pages from any Internet capable device, and they will still int...

Is there anything equivalent to oracle leightweight driver for MySQL ODBC driver install ?

Is it possible to deploy MySQL ODBC just by copying files somehow like in the case of Oracle leightweight client driver ? ...