mysql

How to use PHP Load Data Infile to replace the current copy of the table with the new one?

We get a new copy of data in a pipe-delimited text file from time to time. I have to refresh the table or in other words, replace the existing copy with that of the newly generated copy (output.txt). Any ideas are highly appreciated. Thank you.. TRUNCATE Table elements; LOAD DATA INFILE '/data/out.txt' IGNORE INTO TABLE elements FIELD...

Adding a third table to a Join

Hello, This query works fine: $sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username FROM submission AS s, login AS l WHERE s.loginid = l.loginid ORDER BY s.datesubmitted DESC LIMIT 10"; Would this work if I wanted to join a third MySQL table (called "comm...

MySQL Year Type

Why does the MySQL year type limit the range of allowable years between 1901 and 2155? ...

Flex 3 or Flash Builder 4 for development of Church management system.

hello, i am a learner of flex 3 builder and i have downloaded the Flash Builder beta 2. i have been experimenting with it for a while, i have been given the task to develop a church management system for my church. Because i am new to both technologies, i wanted advice actually as to which will be fastest to build such an application. T...

Making a query result equal to zero when a condition is null

Hello, I believe the query below should work. However, when I run it, the results are blank. I think this is happening since for now, the table "comment" is empty. So there is no instance where s.submissionid = c.submissionid. I would like to have the query below to work even if there if no s.submissionid that equals a c.submissioni...

Adding with PHP to a MySQL database

I am pretty new to PHP and I am trying to make an inventory database. I have been trying to make it so that a user can enter a card ID and then amount the want to add to the inventory and have it update the inventory. For example someone could type in test and 2342 and it would update test. Here is what I have been trying with no success...

Can I do this with just SQL?

At the moment I have two tables, products and options. Products contains id title description Options contains id product_id sku title Sample data may be: Products id: 1 title: 'test' description: 'my description' Options id: 1 product_id: 1 sku: 1001 title: 'red' id: 2 product_id: 1 sku: 1002 title: 'blue' I need to disp...

Number Sequence in MySQL

In Python if I wanted a sequence from 0 - 9 (inclusive) I would use xrange(0,10) . Is there a way I can do this in MySQL? ...

How to display mysql records as preselected checkboxes?

I have a table column called post_tags within a table called posts where assigned tags are stored separated by the @ symbol. I also have a table called tags where all tag names are stored. I would like to design my database in a more normalized way but for the purpose I am trying to achieve this is the easiest option. Anyway, I want to ...

MySQL: Transactions across multiple threads

Preliminary: I have an application which maintains a thread pool of about 100 threads. Each thread can last about 1-30 seconds before a new task replaces it. When a thread ends, that thread will almost always will result in inserting 1-3 records into a table, this table is used by all of the threads. Right now, no transactional support...

mysql encoding problem

i have a proble, when insert something in foreign language into database. i have set the collation of database to utf8_general_ci(try utf8_unicod_ci too). but when i insert some text into table, it was saved like this Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶ Ô±Õ¶Õ¸Ö‚Õ¶ but when i read from database, text shows in correct form. it looks like that only in datab...

MySQL: Is it faster to use inserts and updates instead of insert on duplicate key update?

I have a cron job that updates a large number of rows in a database. Some of the rows are new and therefore inserted and some are updates of existing ones and therefore update. I use insert on duplicate key update for the whole data and get it done in one call. But- I actually know which rows are new and which are updated so I can also...

Can we use JCR API over MySQL?

Apache Jackrabbit (or the JCR API) helps you separate the data store from the data management system. This would mean that every data store provider would have to implement the JCR API for his own data store. The question is JCR implemented for MySQL? Can we use the JCR API over MySQL? I want to truly abstract out where i store my conten...

Using a join with three tables when a field might be null

Hello, The code below works great. It combines data from two MySQL tables. I would like to modify it by pulling in some data from a third MySQL table called "comment." In the HTML table below, "title" is a field in the MySQL table "submission." Every "title" has a corresponding "submissionid" field. The field "submissionid" is al...

When to use which mysql partitioning model

Ok guys, just starting out with partitioning some tables in mySQL. There's a couple of different ways describing this, but what I cant find is a more practical approach. - Which type of data does each way of partitioning have the best effect on? Or doesn't it really matter? Reference: http://dev.mysql.com/tech-resources/articles/perfor...

Partitioning mySQL tables that has foreign keys?

Hi! What would be an appropriate way to do this, since mySQL obviously doesnt enjoy this. To leave either partitioning or the foreign keys out from the database design would not seem like a good idea to me. I'll guess that there is a workaround for this? Update 03/24: http://opendba.blogspot.com/2008/10/mysql-partitioned-tables-with-tr...

mysql_connect "bool $new_link = true" is very slow

Hi, I'm using latest version of Xampp on 64bit Win7. The problem is that, when I use mysql_connect with "bool $new_link" set to true like so: mysql_connect('localhost', 'root', 'my_password', TRUE); script execution time increases dramatically (about 0,5 seconds per connection, and when I have 4 diffirent objects using different conne...

need a good frontend for MySQL for beginner user

implementing a database and need an easy to use frontend. Have tried: HeidiSQL - editing fields was very tedious MySQL-Front - wasnt adding tables through the SQL Editior, and only updated when the prog was restarted. Can anyone recommend a Frontend which they think would be appropriate? Many thanks ...

Combining IN AND LIKE operators

Is there any method to do this: SELECT * FROM `cores` WHERE superkinds IN ('%altro%', '%feste%') Thanks ...

MySQL upload CSV file as new table

I frequently upload CSV files to a MySQL db. It is very convenient to use LOAD DATA LOCAL INFILE to upload the data, but I can't use this to create the table itself. As of now, the best method I have is to use PHP to get the field titles from the first row of the file and then put together a CREATE table query. Is there a more conve...