mysql

Searching MySQL with iphone SDK?

Hi all, I am a bit of a newbie when i comes to iphone dev, but was wondering the best way to retrieve informations form a MySQL database. I have a load of information via a website all stored on a database which changes daily and wanted to build an app that pulled in the information depending on parameters. What would be the best way...

Get last state of item

In MySQL, I have two tables with a 1:n relationship. Table items has products, whose state is kept in another table, like so : items: id |ref_num|name |... 1 |0001 |product1|... 2 |0002 |product2|... items_states : id|product_id|state_id|date 1 |1 |5 |2010-05-05 10:25:20 2 |1 |9 |2010-05-08 12:3...

DataReader with parametrs;

Hello, Everyone! I am currently struggling with MySQL database with DataSet. The thing is that it uses loads of memory(as I found somewhere over the net it uses almost 4x memory rather than when you are using DataReader). What I was thinking is to make a function that will use DataReader for the SQL SELECT command. What I am currently t...

Aggregating multiple distributed MySQL databases

I have a project that requires us to maintain several MySQL databases on multiple computers. They will have identical schemas. Periodically, each of those databases must send their contents to a master server, which will aggregate all of the incoming data. The contents should be dumped to a file that can be carried via flash drive to ...

Insert Date to MySql using c#

I have Date field in my mysql table. I want to insert the date through my Date picker control of windows forms c#. How ? when i tried using below, i am getting error. Code : DB.Insert_Orders(Convert.ToInt32(txtA.Text), Convert.ToInt32(txtB.Text), Convert.ToInt32(txtC.Text), DTP_date.Value.ToString("yyyy/MM/dd")); Error : {MySql.Data...

Duplicating a MySQL table, indexes and data

How do I copy / clone / duplicate the data, structure and indexes of a MySQL table to a new one? This is what I've found so far. This will copy the data and the structure, but not the indexes: create table {new_table} select * from {old_table}; This will copy the structure and indexes, but not the data: create table {new_table} lik...

Mysql Select Second Row

Hi, i have a mysql question. I have a news section on my website, and i want to display the two latest items. If i do: SELECT * FROM nieuws ORDER BY id DESC LIMIT 1 it select's the latest item, and now i want to select the second to last item. Do you guys know how ? Thanks in forward /// EDIT Now it doens't work, here's my co...

BLOB in MySQL view instead of the proper data

Hi, I created a MySQL view using UNION ALL from two tables so that I would get the same column names for the same data in those tables (i.e. tbl1.author2 AS translator ... tbl2.translator AS translator) and so on, the problem is when I try to select something from that view, half of the data comes out as BLOB, instead of the original val...

Question about SQL syntax

Hi, anyone whats wrong with this? why outputs a syntax error? Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 169 Server version: 5.0.51a-3ubuntu5.7 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'localhost' ...

How can I prepare the logs or textfiles to be read by MySQL using Load DATA INFILE INTO ?

What is the best way to prepare the log files before inserting their values in the MYSQL database using LOAD DATA INFILE '/tmp/someFile.txt' INTO TABLE How can I make sure and make the data log file ready to be read by such command ? Someone told me by scripting (using sed,grep,cat,sub ...) .. how can I do that or what are the to...

MySQL Transaction From PHP

QUERY 1: $link = mysql_connect('localhost', 'root', ''); mysql_select_db('rems', $link); mysql_query('SET AUTOCOMMIT=0; START TRANSACTION', $link); mysql_query('DELETE FROM admins WHERE admin_id=4', $link); mysql_query('ROLLBACK; SET AUTOCOMMIT=1', $link); QUERY 2: $link = mysql_connect('localhost', 'root', ''); mysql_select_db('rems...

Second MySQL query doesn't work

Check this code: $select = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMIT 1"); while($row = mysql_fetch_assoc($select)) { $datum = $row['time']; $titel = $row['title']; $bericht = $row['message']; ?> <div class="entry"> <spa...

MySQL: Query from Unknown Number of Tables

Here's what I'm trying to do. I'm using ejabberd with mod_logdb. All conversations are logged to a table in the database tagged with the date. ex: logdb_messages_2010-7-17_server_node What I'm trying to do is write a search that will look in all these tables without hitting the DB too much. I'd like to create a view that takes all the...

Sorted result differs with inner and left joins in mysql

I just found this irregularitry in a query i made, why does the result differ when using inner and left joins? for one, the result is ordered both in the temporary hit table and in the final query? I made a little example to show the problem: # cleanup drop temporary table if exists ids; drop temporary table if exists arts; # create t...

Which mySQL date query performs better?

Hello, I have a query which can be expressed 2 different ways with the same results. Which one is better - for performance or other reasons? First query: SELECT post_id FROM posts WHERE post_date BETWEEN '2010-01-01 00:00:00' AND '2010-12-31 23:59:59' Second query: SELECT post_id FROM posts WHERE YEAR(post_date)=2010 Tha...

How to read multiple files in parallel?

I have a number of text files that I need to open, then allocate certain fields to set strings inside PHP to eventually write into MySQL. Each txt file does have the same unique value for app_id, eg So text file 1 has app_id name description text file 2 has app_id category text file 3 has app_id price I want to get name, descript...

Struggling with MySQL query using joins

I have 3 tables for storing information about books: books ----- id title authors ------- id name books_to_authors ---------------- book_id author_id When a book's information is displayed, I then want to be able to select any other books by the same authors. I have the current book id available from the first query, but I can't fi...

Good tutorial on how to make a site search using PHP?

Is there a tutorial on how to make a search engine using php PHP Version 5.2.8 ...

database design help needed

Design a database to store details about U.S. Presidents and their terms in office. Also, record details of their date and place of birth, gender, and political party affiliation. You are required to record the sequence of presidents so that the predecessor and successor of any president can be identified. Remember Grover Cleveland se...

Building a generic OO ACL using Doctrine...

I'm looking to design a doctrine-backed ACL system for my own use, although I'm struggling with some of the initial design considerations. Right now I'm looking at making it based on classes and unique identifiers, storing them in a table as such: Table: ACL ResourceClass ResourceKey RoleClass RoleKey Permission O...