mysql

Implement MySQL event notification back to a Delphi application

G'Day, Is anyone able to provide some pointers on how I can notify my Delphi application that a particular record in my MySQL database has changed? Something along the lines of the event system from Interbase? Ideas I have looked at: .: Q4M :. (http://q4m.31tools.com/) Pros: Native MySQL solution requiring no external daemons Cons: N...

MySQL user-defined variable in WHERE clause

I want to know if there is a way to use a user-defined variable in WHERE clause, as in this example: SELECT id, location, @id := 10 FROM songs WHERE id = @id This query runs with no errors but doesn't work as expected. Thank you in advance. ...

Can't send content-type: text/xml header from PHP at the same time getting the data from MYSQL

Hi guys, i hope you can cast some light on my problem. I need to do an AJAX / PHP / MYSQL application to display posts and stuff on the page i'm writing. I only discovered how to do some simple stuff in PHP after taking some mushrooms but that was years ago and now i don't have mushrooms and i'm just stuck! So here's the problem: i t...

Is there a workaround for using LIMIT in a subquery in MySQL?

Here is my original query... SELECT `id` FROM `properties` LIMIT 10, 20 The LIMIT condition is for pagination. Now, I have to get all like before, but I need to get only a third of rows where a condition is present. I came up with this, just throwing LIMIT 30 in before I figured out how to do (total rows matched / 3) * 2. SELECT...

Doctrine - encryption with dql listeners

I am attempting to encrypt certain database fields by adding a call to mysql AES_ENCRYPT (and AES_DECRYPT) using Doctrine DQL Hooks. for SQL SELECT's I have a preDqlSelect() in my Doctrine_Record_Listener class, which goes through each parameter in the select fields, and adds a AES_DECRYPT() for encrypted fields. But, it looks like ca...

How can I order a query result same as the id specified in the WHERE condition?

I have a query like this SELECT * FROM test JOIN test2 ON test.id=test2.id WHERE test.id IN (562,553,572) GROUP BY test.id Its results are ordered like this: 553, 562, 572... But I need the same order that I specified in the IN(562,553,572) condition. How can I do that? ...

Time Estimate for a Contract PHP/Mysql Web Application Job

I'm debating contracting the development of a web application but don't want to insult a professionally experienced programmer with my budget if it's unrealistic. Can someone with expertise here comment on how much time you'd spend or payment you would expect to program the following type of project from scratch? Project is basically ...

MySQL index selection criteria

Hi there, I have a scenario, where I have though optimized the query, but don't understand on what basis the query optimizer choses to use a particular index. I am running the following query. SELECT r.review_id FROM game_reviews r INNER JOIN game_subchannel gs ON r.game_id = gs.game_id WHERE gs.subchannel_id=4 My table...

Compare 2 MySQL tables with PHP and display them along with differences

Hello, I am working on an inventory system. Basically here is how I imagine it would work. If you have a better solution, please don't hesitate to let me know. I get daily inventory update from my supplier in the following format: sku, inventory_count, status sku is the unique identifier here. inventory_count is integer and status is...

How to select standard deviation within a row? (in SQL - or R :)

Dear all, I wonder if there is a way to select the standard deviation from several integer fields in MySQL within the same row. Obviously, if I use SELECT STDDEV(col1) FROM mytable I just get the standard deviation of that particular column. Let´s assume I have a table like: id,somefield1,somefield2, integerfield1,integerfield2,inte...

How to reduce the program execution time in PHP and how to improve the performance

Hi, I am running mysql select queries 3500 times in a for loop and perform operations on the values returned by the queries in PHP. that process takes 16 seconds to execute for loop. any suggestion to reduce the execution time and improve the performance. thanks! ...

PHP MySQL print only empty column names from database row

$sql = "SELECT * FROM table"; $result = mysql_query($sql); while($row = mysql_fetch_row($result)){ // PRINT COLUMN NAMES WITH EMPTY VALUE } how can i do this? thanks ...

Need help in optimising query.

I have two tables - incoming tours(id,name) and incoming_tours_cities(id_parrent, id_city) id in first table is unique, and for each unique row from first table there is the list of id_city - s in second table(i.e. id_parrent in second table is equal to id from first table) For example incoming_tours |--id--|------name-----| |---1--|...

How fetch 1 more but get rid of it later?

Currently I fetch rows with the help of mysql_fetch_array() (and the LIMIT/OFFSET) (ie. while ($row = mysql_fetch_array($res)) { ... }); but the last row is not needed as it was to be fetched in order to make sure there is at least one more row left - it is not for display. ...

Migrating from MySQL > PostgreSQL (PHP/Doctrine)

I have a system with 25 tables. I ran a utility to basically get all my data to a postgres table, but now I'm getting a lot of errors in the front end of my website after I switched the db driver. How can I go about completely migrating my current PHP/Doctrine MySQL system to work with Postgres? ...

phpMyAdmin wants to add multiple indices as one multi-column index

Hey, I'm creating tables using phpMyAdmin and want to define two different columns as indices. I'm not trying to create a multi-column index but phpMyAdmin creates them as such. Are there any possible issues with that? The fields don't relate to each other directly and both fields will not be used in WHERE clauses simultaneously. Consi...

Display past dates before the year 1800

I have a system for history events. It's showing the date using this date("j F, Y", strtotime($row['dated'])); But when I try: 21 Oct 1877, it's showing 31 December, 1969. How can I fix this problem? ...

mysql join question, joining newest record in a one to many relationship.

Hi all, I have a simple (hopefully) SQL question for you, any help would be much, much appreciated :). I have two tables which I would like to join. One Is Users, lets say it's called users One is a kind of history of that user, lets say its called users_history. The relationship of these two is a one users to many users_history rel...

What is the best way to make autocomplete field using jquery (With mySql or XML ?)

My autocomplete field: http://www.faressoft.org/autocomplete/ What is the best way to make autocomplete field using jquery (With mySql or XML ?) and what is the reason ? How to minimize consumption of server resources ? What is the best way if i have a big database or a small batadase ? mySql or XML ...

PHP recursive function to delete all child nodes causes stackoverflow

My MySQL looks like this: (the name of the table is category) 'id', 'content', 'parent' where: id = the id of the category content = some-text-we-dont-care-about parent = the id of the parent category this is what I'm trying right now: function remrecurs($id) { $qlist=mysql_query("SELECT * FROM category WHERE parent='$id'"); ...