mysql

Make mysql_fetch_assoc automatically detect return data types?

When using mysql_fetch_assoc in PHP, how can I make it return the correct data types? Right now it appears to convert everything to strings, I'd prefer if it left the Ints as Ints, and somehow designated the Date/Time as either Object or somehow different than strings. The reason for this is that I am using PHP as a backend to a Flex ap...

Batch inserts with PHP

Java has the PreparedStatement addBatch + executeBatch to do multiple insertions efficiently. What is the fasted way to do a batch of inserts using php's mysqli extension? Thanks! ...

NHibernate, MySQL, Windows Server 2003 -- connection problems

We're using MySQL (5.0.x) on Windows, in an ASP.NET MVC app. Recently, we started using NHibernate in a lot of places, and it works great in the ASP.NET app. On Vista and Windows Server 2008, it still works great everywhere. We've also got a couple command-line tools that use the same codebase, and they work everywhere except on our W...

How can I store my Rewrite Rules in a database?

Hey everyone, Im developing a new site, and I'd like to store my rewrite rules in a database, instead of right in the .htaccess files. I have another site that uses Opensef (http://sourceforge.net/projects/opensef/) with a Joomla! installation that is doing this, but im not even 100% how it works underneath the hood. How can I store t...

Cocoa MySQL Framework pointers and/or advice?

Hey, I'm looking to find a good MySQL framework for Cocoa that I can use in my XCode projects to access a database on the web. Do you know of any good, open source/free ones? I have looked at http:// mysql-cocoa.sourceforge .net/index.html but haven't had a chance to play with it. Should I start there or is there something better? Tha...

Is there an easy way to get a Unix timestamp from an SQL timestamp in php?

My database table has a column that contains SQL timestamps (eg. 2009-05-30 19:43:41). I need the Unix timestamp equivalent (an integer) in my php program. $posts = mysql_query("SELECT * FROM Posts ORDER BY Created DESC"); $array = mysql_fetch_array($posts); echo $array[Created]; Where it now echoes the SQL timestamp, I want a Unix ti...

Multilingual fields in DB tables

I have an application that needs to support a multilingual interface, five languages to be exact. For the main part of the interface the standard ResourceBundle approach can be used to handle this. However, the database contains numerous tables whose elements contain human readable names, descriptions, abstracts etc. It needs to be pos...

How to make comment reply query in MYSQL?

I am having comment reply (only till one level) functionality. All comments can have as many as replies but no replies can have their further replies. So my database table structure is like below Id ParentId Comment 1 0 this is come sample comment text 2 0 this is come sample comment text 3 0 ...

Php comments script

Anyone know where I can find a simple comments script in php/mysql, i just want a system that has the basic font enhancements, url links, image and reply functions. Thanks. ...

Best free way to store 20 million rows a day?

Daily 20-25 million rows that will be removed at midnight for next days data. Can mySQL handle 25 million indexed rows? What would be another good solution? ...

How should 'raw binary data' hashes be stored in MySQL?

I'm wanting to store hashed passwords in MySQL, I'm using PHP: <?php $salt = '!£$%^&*()#'; $username = 'abc'; $password = '123'; $hash = hash('sha1', $username . $salt . $password, true); ?> The true parameter in hash() will return the value as raw binary data. But I don't understand what this means exactly. How should...

mysql fake select

My purpose is: to get multiple rows from a value list,like (1,2,3,4,5),('a','b','c','anything') and so on. mysql> select id from accounts where id in (1,2,3,4,5,6); +----+ | id | +----+ | 1 | | 2 | | 3 | | 5 | | 6 | +----+ 5 rows in set (0.00 sec) The above sql is surely ok,but my question is:is there a way to get the same result...

mysql select sum group by date

Quick question, I have the following table +-------------+---------------------+ | total | o_date | +-------------+---------------------+ | 35 | 01-11-2009 19:32:44 | | 41.5 | 01-12-2009 22:33:49 | | 61.5 | 01-23-2009 22:08:24 | | 66 | 02-01-2009 22:33:57 | | 22.22 | 02-01-200...

mysql performance comparison

Which is more efficient,and by how much? type 1: insert into table_name(column1,column2..) select column1,column2 ... from another_table where columnX in (value_list) type 2: insert into table_name(column1,column2..) values (column1_0,column2_0..),(column1_1,column2_1..) The first edition looks short,and the second may become ex...

Is there a service that can help me Quote the SQL strings properly?

Hi there, I'm having a hard time quoting SQL string properly, I want to know if there's a program or a website that can help me quote the string correctly. Where I can enter the SQL strings then the website will analyze and quote it for me. Or maybe a program.. I need it cause I'm having a trouble with them.. Sorry for not providing a ...

Change MySql Case sensitivity with phpMyAdmin?

I am running Blogengine.Net and have noticed that the tables are all created lower case (table name be_settings) but a lot of the queries are written mixedcase (Select * from be_Settings). This works fine if your MySql instance is running on Windows or set for capatability with Windows. I am getting an error as my hosting provider MySq...

Writing a PHP file to read from CSV and execute SQL Query

Hi, I would like a PHP script to read the contents from a CSV file in the following format id, sku 1,104101 2,105213 there are a total of 1486 entries, I believe that it's better to use a for loop instead of while !EOF. After that, I would like to perform SQL query on a database named m118, table catalog_product_entity. The query w...

How to make mysql accept connections externally

I have a VPS and I want to make mysql DB accept connection externally (from my PC for instance). I have Debian Linux installed on the server. I checked some tutorials online and they said to comment out: bind-address = 127.0.0.1 But this didn't seem to help! is there anything specific for VPSs? or Am I missing something else...

SQL group by problem

I have a query which does a number of joins and has a few criteria in the WHERE clause, and I'm ending up with a result which essentially looks like this: | userId | date | otherData | |--------+------------+------------| | 1 | 2008-01-01 | different | | 1 | 2009-01-01 | info | | 1 | 2010-01-01 | for ...

Upgraded mysql from 5.0 to 5.1, now Rails 2.3 is broken (on Mac)

I upgraded mysql on my Mac from 5.0.x to 5.1.x (using a dmg package directly from mysql.com), which broke Rails (2.3.2). Previously everything was working correctly. The error I get is this: !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. So I tried re-inst...