mysql

mysql php problem: no error message despite error_reporting(E_ALL) line

index.php <html> <head> <title>Josh's Online Playground</title> </head> <body> <form method="POST" action="action.php"> <table> <tr> <td>"data for stuff"</td> <td><input type="text" ?></td> </tr> <tr> <td><input type="submit"></td> </tr> </table> </form> ...

SQLAlchemy: How to group by two fields and filter by date

So I have a table with a datestamp and two fields that I want to make sure that they are unique in the last month. table.id table.datestamp table.field1 table.field2 There should be no duplicate record with the same field1 + 2 compound value in the last month. The steps in my head are: Group by the two fields Look back over the las...

Update a field thanks to a subquery based on another field

Hi, I use a MySQL DB, and I would like to update a field in a table based on another. Something like: UPDATE table1 SET field1 = table2.id WHERE field2 IN ( SELECT table2.name FROM table2 ); I know that this query wouldn't work, but here is the idea. Is that even possible to do? Cheers, Nicolas. ...

Get a DB result with a value between two column values

Hi, I have a database situation where I'd like to get a user profile row by a user age range. this is my db: table_users username age email url pippo 15 [email protected] http://example.com pluto 33 [email protected] http://example.com mikey 78 example@exam...

MYSQL Download Links.....

I want to download MySQL Database..... Any one can suggest me for best link to download the MYSQL ...

MySQL & PHP while code is out of memory, when there is only one row

Hey all, why is this code throwing an out of memory error, when there is only 1 row in the database.. $request_db = mysql_query("SELECT * FROM requests WHERE haveplayed='0'") or die(mysql_error()); $request = mysql_fetch_array( $request_db ); echo "<table border=\"1\" align=\"center\">";...

What's the Correct name for a Association table (many to many relationship)

What's the Correct or most popular name for a Association table? I've heard Lookup,associative,resolving,mapping and junction table so far? Thank you in advance;-) ...

mysql select where count = 0

Hi, In my db, I have a "sales" table and a "sales_item". Sometimes, something goes wrong and the sale is recorded but not the sales item's. So I'm trying to get the salesID from my table "sales" that haven't got any rows in the sales_item table. Here's the mysql query I thought would work, but it doesn't: SELECT s.* FROM sales s NATU...

App Engine and MySQL

I just wanted to ask if we can access an external MySQL server from Google App Engine... ...

I need to take all unique data from a mysql table and put it into a new table

Hi, I have a database table (mysql 5) something like this example data: id,name,description 1,example,test description 2,example,different desc 3,example*2*,another desc 4,example*3*,blah blah blah (note that #1 and #2 have the same name, 3 and 4 are unique. what i want to do is make a new table, with just this dat...

Compare range of ip addresses with start and end ip address in MySQL

I have a MySQL table where I store IP ranges. It is setup in the way that I have the start address stored as a long, and the end address (and an id and some other data). Now I have users adding ranges by inputting a start and end ip address, and I would like to check if the new range is not already (partially) in the database. I know I ...

How to create a MySQL query for time based elements with a 'safe window'?

I am no SQL expert, far from it. I am writing a Rails application, and I am new at that as well. I come from a desktop programming background. My application has a table of data, one of the columns is the time at which the data was logged. I want to create a query with a 'safe window' around EACH row. By that I mean, it returns the ...

Get result from mysql orderd by IN clause

I have the following query SELECT * FROM invoice WHERE invoice_id IN (13, 15, 9, 27) My result is: invoice_id | invoice_number | ... ------------------------------------ 9 | 201006003 | 13 | 201006020 | 15 | 201006022 | 27 | 201006035 | which is the result set I want except that ...

Select one row for each different value of column, MySQL

Hi Guys, Im a bit stuck and cant get my head around this MySQL. Here are my abridged tables I wish to query: print(printID, eventID, printTime) sales(saleID, eventID, saleTime) I wish to get the last print time for each event, then select the sale IDs which have that eventID with a sale time greater than the last print time. ...

limiting user actions by months

hi my users upload photo and all uploads recorded in mysql with the date info. i want to limit uploads by the months. user may just upload 3 pics in a month. what is the best way to do this ? cheers ...

SQL LEFT JOIN help

My scenario: There are 3 tables for storing tv show information; season, episode and episode_translation. My data: There are 3 seasons, with 3 episodes each one, but there is only translation for one episode. My objetive: I want to get a list of all the seasons and episodes for a show. If there is a translation available in a specified...

Import excel files with image in php/mysql

Hi all! I want to make an import script which allows users to upload their excel file (extension not important) to my php application. The application should reconize a list of items (so far so good). The difficulty in this case is that the excel files contain images...I've read information about phpexcel library but it does not say anyt...

mysql fulltext search as level2 index

lets say I have a table with product details. one of the fields is category (integer). I want to do fulltext search on product name in specific category. Unfortunately Mysql does not allow me to specify index that includes category and product name as fulltext. It looks like I can use fulltext only on product_name and theefore any ful...

postgresql is incrementing an update by 2 ?

I'm migrating our model to postgresql for the FTS and data integrity update myschema.counters set counter_count= (counter_count+1) where counter_id =? Works as expected in mysql, however in postgres it is incrementing by 2 each time? It is simple int field I believe, I don't have anything special going on. ...

Fixtures in groups of timestamp

The following code brings up all the fixtures from the database. while ($row = mysql_fetch_assoc($result)) { echo $row['date']; echo $row['home_user']; echo $row['home_team']; echo $row['away_user']; echo $row['away_team']; } The problem I have is all the fixtures are just listed. T...