mysql

high overhead in new mysql table

Hi, does anyone knows why I get an overhead of 131.0 MiB on a newly created table (zero rows)? im using phpmy admin and the code of my script is CREATE TABLE IF NOT EXISTS `mydb`.`mytable` ( `idRol` INT NOT NULL AUTO_INCREMENT , `Rol` VARCHAR(45) NOT NULL , PRIMARY KEY (`idRol`) ) ENGINE = InnoDB; thanks in advance. ...

What is the question mark's significance in mysql?

I am dissecting some code and came across this, $sql = 'SELECT page.*, author.name AS author, updator.name AS updator ' . 'FROM '.TABLE_PREFIX.'page AS page ' . 'LEFT JOIN '.TABLE_PREFIX.'user AS author ON author.id = page.created_by_id ' . 'LEFT JOIN '.TABLE_PREFIX.'user AS updator ON updator.id = page.updated_by_id ' ...

Alternatives to the MEMORY storage engine for MySQL

Howdy! I'm currently running some intensive SELECT queries against a MyISAM table. The table is around 100 MiB (800,000 rows) and it never changes. I need to increase the performance of my script, so I was thinking on moving the table from MyISAM to the MEMORY storage engine, so I could load it completely into the memory. Besides the ...

how do I add a foreign key pointing to the same table using myphpadmin?

I have an existing InnoDB table which already has foreign keys pointing to different tables. But when I try to create a foreign key pointing to the Primary index, I get an error (check data type). The table is User with User_Id as the Primary. I want a foreign key Manager_ID which is a FK to User_Id. Both of INT Both of Length 10 Uns...

Fetching linked list in MySQL database

I have a MySQL database table with this structure: table id INT NOT NULL PRIMARY KEY data .. next_id INT NULL I need to fetch the data in order of the linked list. For example, given this data: id | next_id ----+--------- 1 | 2 2 | 4 3 | 9 4 | 3 9 | NULL I need to fetch the rows fo...

Codeigniter security - mysql database

I'm in the final stages of implementing a codeigniter site which requires a really simple login system: one user and one password, to protect the admin area. I think I will be using one of the many CI authentication libraries, which should allow me to ensure that people can't read from the database without being logged in as admin(I hop...

Cloning a MySQL database on the same MySql instance

I would like to write a script which copies my current database sitedb1 to sitedb2 on the same mysql database instance. I know I can dump the sitedb1 to a sql script mysqldump -u root -p sitedb1 >~/db_name.sql and then import it to sitedb2. Is there an easier way, without dumping the first database to a sql file? ...

iPhone Uploading unique images to a server running PHP / MYSQL

Hi All, I'm working on an iPhone app that will upload images to a web server. I was wondering if anyone had any tips on how to generate unique names for each image file that gets uploaded. I'm sure there are a million ways to do this, but if anyone has any suggestions I'd really appreciate it! Thanks. ...

Are you allowed to use numbers as table names in MySQL?

I'm thinking of having a program that dynamically creates new tables as the need arises. Can I have tables named with just numbers in MySQL? ...

MYSQL ERROR

Bear with me I am a bit new to all this, I have this query running in my PHP script: $insertQuery = "INSERT INTO blog_articles VALUES '$title', $tags', '$category', '$blog', '$author', '$date'"; I then run this script: if ($result = $connector->query($insertQuery)){ // It worked, give confirmation echo '<center><b>Artic...

auto_increment by group

Is there a way with MySQL (5.0 specifically) to have an auto_increment field who's value is based on a grouping column? Example: id name group_field 1 test 1 2 test2 1 1 test3 2 2 test4 2 1 test5 3 2 test6 3 I'd like to not have to go through any 'crazy' methods to achive this, but will if necessary. ...

Replace empty record of column with 'foo' on SELECT query?

I'm backing up MySql -table to worksheet. My current result-set has rows where some of columns are empty. That's ok, but for the worksheet i need these to be replaced with 'foo'. HowTo? All help is highly appreciated. ...

Complicated MySQL Stored Proceedure

I have a semi-complicated stored proceedure that I need to create. I'm not exactly a DBA here but no one else in my company is better than I am. The basic idea is I have a group of tasks. The user completes these tasks and gets a flag for each task completed. To be considered "complete" the user has to have all of a group of given tasks ...

Python and MySQL: is there an alternative to MySQLdb?

Is there a module written purely in Python that will allow a script to communicate with a MySQL database? I've already tried MySQLdb without success. It requires too much: GCC, zlib, and openssl. I do not have access to these tools; even if I did, I don't want to waste time getting them to work together. I'm looking for tools that will m...

MySQL ORDER problem

I have a pretty simple SQL query but something is missing and I didn't find an answer for this problem yet. The thing is that I select some fields with several ids and I want the result to be ordered in this particular order. The query is the following SELECT `content`.* FROM `content` WHERE (user_id = "1" AND ( id = "4" OR id = "...

Summarize gridview

In an asp.net page I have five gridviews listing some numbers. In the header of each gridview I want to summarize the numbers in the listings. So if the listing contains rows with numbers 1,2,3 the title in the header would be 6. I can't find a way to do it in my query for the gridview (SELECT number,SUM(number) FROM tbl, is not workin...

Does MySQL included with MAMP not include a config file?

I can't seem to find the my.cnf or other config file for the MySQL that comes with MAMP. Does it not include one? ...

MySQL Replication: Preventing master server from replicating table inserts

I have a logging table on the master server that is inserted into very often. I don't need this table replicated to the slave servers, and in fact I already have replicate-ignore-table set on the slaves to ignore it. However, that only happens after all of those inserts are fetched from the master. I'd like to prevent those inserts from...

MySQL AND Filemaker Pro?

Hi All, I have a client that wants to use Filemaker for a few things in their office, and may have me building a web app. The last time I used, or thought about, or even heard of, Filemaker was about 10 years ago, and I seem to remember that I don't want to use it as the back end of a sophisticated web app, so I am thinking to try to s...

Mysql, Possible Nested Category problem

I have a mysql question. I have an application which I am migrating to PHP/Mysql from Coldfusion and MSSql. There are categories and sub-categories (with apparently unlimited sub-categories). What is the best way to grab all of the records in a products table given a navigationID. there are two tables I am dealing with. One is the P...