mysql

Saving auto increment in MySQL

Hello, I am trying to sync between 2 tables: I have active table where has auto_increment, and I have archive table with the same values. I would like both ID's to be unique (between the tables as well) - I mean, I would like to save auto incremenet, and if I UNION both table I still have uniqness. How can I do that? Is there a possibili...

Understanding large mysql data relations

I am trying to teach myself how to use SQL, namely mysql. What I am trying to understand is how to deal with many different types of data with in the same table. Say I am building a web application, and I have many different content types (blog item, comment item, files, pages, forms) that I need to store different data fields for each...

configure c3p0 with multiple mysql instances

Hi, i just wonder how to configure a c3p0 instance in a web-server against a master/slaves configuration of mysql ? it means that one c3p0 instance may make connections to more than one mysql servers at a time. Thank you Lee ...

Create table if not exists from mysqldump

I'm wondering if there is any way in mysqldump to add the appropriate create table option [IF NOT EXISTS]. Any ideas? ...

PDO mySql query not executing in for loop the second time up while calling

I have an issue, I'm looping threw a set of values and then creating a PDO mySql query with every loop, now the problem is the first query is executing and returning results, but the second upwards aren't returning results. If I manually execute the queries on the server they return results. This is weird, maybe I'm doing something wrong...

MySQL - beginners question

Hi - my knowledge of databases is very fuzzy. I am plannig on learning it soon. Am I right in thinking that you only need ONE installation of a MySQL per computer....and this could then be used by different platforms? For example both PHP and RubyonRails could both run of the same installation? ...

MySQL - A way to join all found rows in one column

Hi, I have this table: CREATE TABLE `dummy` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` VARCHAR( 30 ) NOT NULL ) ENGINE = MYISAM ; and running this query: SELECT GROUP_CONCAT(`name` SEPARATOR "||") FROM `dummy` This query joins name column in all rows with || in a single column. BUT, the result is truncated wit...

Getting last insert id in Excel ADODB connection to MySQL database

I have the following code to insert items into a MySQL database from an Excel form. Set rs = New ADODB.Recordset ConnectDB With wsWorkBook strSQL = "INSERT INTO work_order (job_status, job_description, system_id) VALUES ....;" rs.Open strSQL, oConn, adOpenDynamic, adLockOptimistic ' word_order.id End With How can I get the...

How to group data changes by operation with MySQL triggers

I am using triggers in MySQL to log changes to the data. These changes are recorded on a row level. I can now insert an entry in my log table for each row that is changed. However, I also need to record the operation to which the changes belong. For example, a delete operation like "DELETE * FROM table WHERE type=x" can delete multiple...

create table in mysql with default boolean false

Want to create table in mysql with th e default boolean false... it's accepting null as defult ...

Why doesn't this loop display an updated object count every five seconds?

I use this python code to output the number of Things every 5 seconds: def my_count(): while True: print "Number of Things: %d" % Thing.objects.count() time.sleep(5) my_count() If another process generates a new Thing while my_count() is running, my_count() will keep printing the same number, even though it ...

MySql query cache settings

How can I set the query cache of MySql? My "my.ini" file doesn't contain the variable mysql_query_type or mysql_query_size at all... How are these set? Can they be set from PHP? Thanks ...

Zend_Db_Table_Abstract and MySQL COMMENTs

I have built a query tool that enables a non-technical user to query parts of a database. I want to rename all the columns nicely. e.g.: table_id` > "Table ID" forename > "Forename" phone > "Telephone" I have put all the information into the MySQL COMMENT field as in: ALTER TABLE `table` CHANGE `field` `field` INT( 11 ) NOT NULL COM...

Best approach to relating databases or tables?

What I have: A MySQL database running on Ubuntu that maintains a large table of articles (similar to wordpress). Need to relate a given article to another set of data. This set of data will be fairly large. There maybe various sets of data that will be related. The query: Is it better to contain these various large sets of data w...

access denied for load data infile in MySQL

I use MySQL queries all the time in PHP, but when I try LOAD DATA INFILE, I get the following error #1045 - Access denied for user 'user'@'localhost' (using password: YES) Does anyone know what this means? ...

Where is the file located in Load Data Infile?

If I use a Load Data Infile MySQL query in PHP, where is the file location relative to? Is it the same folder as the PHP file? ...

how to store and search mp3 by its content.

I want to store multiple mp3 files and search them by giving some part of song, to detect which song it is. I am thinking of storing all binary content in mysql and when I want to search for a specific song by content I will take some middle portion of song and actually match it with the binary data in MySQL. My questions are: Is thi...

Prevent filesystem caching for MySQL queries

Hi. When i disable query cache in mysql, queries still cached. As I understand it is because of OS filesystem cache. How can i prevent filesystem on cache this data. I working on WIndows 7 but it might be the Linux. ...

how to get image whose path is stored in database in Gridview of asp.net

Hi i have stored the images in mysql using the varchar datatype and i am storing the path of that and i want to retrive that images in the gridview of asp.net ...

What is the best way to echo results from the database into html code in PHP ?

when I have a value like this in the database ("foo") how can I echo it without any conflict with html code notice <input type="text" value="<? echo '"foo"'; ?>" /> the result will be like this <input type="text" value=""foo"" /> how can I fix it ? ...