mysql

Delete Rows So i have a max Row Limit

Here is what im trying to do explained in a query DELETE FROM table ORDER BY dateRegistered DESC LIMIT 1000 * I want to run such query in a script which i have already designed. Every time it finds older records that are 1001th record or above it deletes So kinda of setting Max Row size but deleting all the older records. Actually i...

can't find my database space limit ?

Hello, in my webhosting, i can't find how much space i'm allowed to store in databases, is that counted with the files disk space? Thank you ...

How do you know when you need separate tables?

How do you know when to create a new table for very similar object types? Example: To learn mysql I'm building a model solar system. For the purposes of my project, planets have many similar attributes to dwarf planets, centaurs, and comets. Dwarf planets are almost completely identical to planets. Centaurs and comets are only different...

How to export data from the database into .csv format programmatically?

I have stored some data in MySQL database through a java program. Now I want to export that data from the same program in .csv file. I know One method of doing this is to get all the fields of one row in variables and then store them in a file by seperating them with a comma(,) and by repeating the same for every row in the database. B...

Will the MySQL datetime format work with SQLite and PostgreSQL?

In MySQL you enter dates (datetime field) in the format 2009-10-16 21:30:45. Which makes it simple to insert times into the database. $date = date('Y-m-d H:i:s', $timestamp); Will this format work with SQLite and PostgreSQL? If not, what format do they use? ...

Efficiently synchronizing warehouse information

Ok, let's see if you Wizards can help me with this problem I'm banging my head against. The scenario is a pretty standard setup with a point of sale (that's where I am) and a backoffice keeping track of warehouse information. The problem is that I need to synchronize the database at the point of sale with the current stock information f...

Invalid parameter number on PDO Prepared Statement

Hello, I'm working with a sequence of queries created with PDO class, in some case, my queries needs the same paramter. I've created an array used in a foreach statemend which save the data but some var is ouside, can I use both data in one query? the example: // $connection is the PDO object; // $full_data contains: // $full_data[$i][...

How should I write PHP $_POST vars in a mysql_query function?

Hi all, In accessing my database, I have the user fill out a form, and in the target page, the posted values are used in the resulting MySQL query. $query = mysql_query("SELECT pass FROM database WHERE user='$_POST[user]'"); However, for some reason or another, MySQL doesn't like my using a $_POST variable in the command, and it only...

Using a java class to create a database

Hi, I'm working in an application that uses servlets and mysql. I'd like to create a .jar file able to create the database that the application will be using. This will only be done once, in order to create the db. I've no problem in getting to access to a database, doing something like this: Class.forName("com.mysql.jdbc.Driver").ne...

Why is my Slave not starting on MYSQL?

mysql> start slave; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> show warnings; +-------+------+--------------------------+ | Level | Code | Message | +-------+------+--------------------------+ | Note | 1254 | Slave is already running | +-------+------+--------------------------+ 1 row in set (0.00 sec) mys...

Pseudo codestructure to Mysql?

Can somebody help get the following pseudocode in mysql? The resulting selects in the IF statement all return the same columns (4) and multiple rows (unknown) so that's not really the problem i'm facing.. How can I get the following structure in Mysql? //parameters @p1; @p2; @v1; @v2; //vars @t1= 15000; @t2 = 15000; //calculated vars...

In a master-master setup, what command or files do I edit so that it can auto-increment by 2?

One server increment 1, 3, 5. The other server increment 2, 4, 6 ...

where is mysql server's default data folder in windows 7

Hi, I am looking for the data directory of mysql server (5.1.42) I installed on my machine which runs win7. There is no 'data' direcotory in C:\Program Files\MySQL\MySQL Server 5.1 and also in C:\Users\MyAccount\AppData\Local||LocalLow||Roaming ...

How can i make this MySQL query work?

I have a table called 'bandsplusrating' and a table called 'ratings' The table 'bandsplusrating' is filled with bands, the table 'ratings' starts empty. Both tables have field called 'naam' with which they can be joined. Table 'ratings' has a field called 'fullname' Multiple Ratings per band (bandsplusrating) will be stored in table 'r...

Is there any harm in resetting the auto-increment?

I have a 100 million rows, and it's getting too big. I see a lot of gaps. (since I delete, add, delete, add.) I want to fill these gaps with auto-increment. If I do reset it..is there any harM? If I do this, will it fill the gaps?: mysql> ALTER TABLE tbl AUTO_INCREMENT = 1; ...

Speeding up a PHP App

I have a list of data that needs to be processed. The way it works right now is this: A user clicks a process button. The PHP code takes the first item that needs to be processed, takes 15-25 secs to process it, moves on to the next item, and so on. This takes way too long. What I'd like instead is that: The user clicks the proces...

Using Memcache as a counter for multiple objects

I have a photo-hosting website, and I want to keep track of views to the photos. Due to the large volume of traffic I get, incrementing a column in MySQL on every hit incurs too much overhead. I currently have a system implemented using Memcache, but it's pretty much just a hack. Every time a photo is viewed, I increment its photo-hits...

MySQL - Select All Except what is in this Table

I am wanting to select all images that a user does not already have. I have three tables: user, image, and user_image: _user (id, user, pass) _image (id, data) _user_image (id, user_id, image_id) ...

MySQL Update Serialized Data

How to update serialized data in DB Table field? I want to store serialized data to reduce count of queries but don't have idea how to update them. ...

MySQL Query - Result Table Name

When I query a mysql database in PHP, I can not figure out how to specify the table of the field in the result set. For example, I would like to do the following: $row = mysql_fetch_assoc($result); $row["table.FIELD"]; But, can not figure out how. Surely, it is able to happen somehow. EDIT: I have checked documentation, and have f...