I'm using MySQLdb library to connect to MySQL within my Python script.
(Ref: http://mysql-python.sourceforge.net/MySQLdb.html ).
I would like to learn if there is a way to jump to the last record in a resultset using Python?
In other words, I would like to move my cursor to the last record in the resultset.
...
Say I have a table of real estate properties:
A 15,000
B 50,000
C 100,000
D 25,000
I'd like to group them by 0 - 49,999, 50,000 - 99,999 and 100,000 - 200,000
So the result should be:
0 - 49k (2)
50k - 99k (1)
100k - 200k (1)
Is there a way to do that in one SQL statement? I'm using Postgres by the way.
...
Hai guys,
What is wrong in this code i get an empty array. i am passing a php variable to the query it didnt work, when i give a hardcoded value the query returns result.
echo $sub1 = $examSubject[$i];
$subType = $examType[$i];
$query = $this->db->query("select dSubject_id from tbl_subject_details where dSubjectCode='$sub1'");
print_r(...
I am working on a Flex app that has a MySQL database. Data is retrieved from the DB using PHP then I am using AMFPHP to pass the data on to Flex
The problem that I am having is that the data is being copied from Word documents which sometimes result in some of the more unusual characters are not displaying properly. For example, Word ...
Hello,
If I had a MySQL table called "info" as described below and I wanted to print out an HTML table as described below, how would I do it?
Fields in MySQL table:
id subject category actions date status
HTML table structure: Two columns, first containing the field "subject", next containing the field "actions," sorted by "actions...
I am attempting to add an "export to CSV" feature to a webapp that displays data from a MySQL database. I have a written a "queryExecuter" class to execute queries from my servlet. I have used this to successfully execute insert queries so I know the connection works etc however queries with the "into outfile" statement are simply not ...
Can Anybody tell me how to connect ASP to MySQL database..
I have already install MySQL in my localhost,
Add a connection through Data Source (ODBC) in ctrl panel and test connection succeed.
Now I want to show the query on my default.aspx page so that I can do the insert / update / delete my table data in MySQL.
Can anyone help me?
...
I need a DBMS, but do not know which to choose.
Basically, the application makes many INSERT / UPDATE, but also many SELECT. SELECT mostly very simple, one field only.
I am using MySQL + InnoDB at the moment, but as the database is growing, I need the best solution. The table can grow indefinitely, and the time +- 2GiB
EDIT:
Will run ...
Hi,
I have a problem in Grails 1.1.2 + MySQL.
My domain class Something contains field
Map<String, Map<Integer, Integer>> priceMap
When I run the app, Grails creates table 'something' and sub-table 'something_price_map'. 'something_price_map' contains
BIGINT(20) price_map
VARCHAR(255) price_map_idx
TINYBLOB price_map_elt
The pr...
Hello!
I already posted a similar problem and it was resolved, but now I'm trying to work with array of objects and I'm not sure how to resolve this:
So, I have an array similar to this:
array(10) {
[0]=>
object(VO)#6 (35) {
["eventID"]=>
string(1) "1"
["eventTitle"]=>
string(7) "EVENT 1"
["artistID"]=>
st...
Creating simple php login scripts is easy, with simple one table mysql integration. I was wondering how i could you the rather snazzy HTTP Authentication that is available in HT Access and PHP, but the users are checked against a mysql database?
I am sure this is possible, but i have no idea how :/
...
Hi all,
I'm converting a webapp from mysql to SQL Server. Now I want to convert the following code (this is a simplified version):
LOCK TABLES media WRITE, deleted WRITE;
INSERT INTO deleted (stuff) SELECT stuff FROM media WHERE id=1 OR id=2;
DELETE FROM media WHERE id=1 OR id=2;
UNLOCK TABLES;
Because I'm copying stuff which is goin...
Each item in c_data is in a category/section. I would like to limit how many items are displayed per category, rather than limiting the total number of items retrieved. Obviously if I add something like "limit 20" to the query, it will only fetch 20 results in total, rather than 20 results per category.
SELECT cm.id,
...
Hi,
I have two databases in a php / mysql application. One for user data and the other for content.
I have recently had to make use of inno db tables in order to enforce some referential integrity. Obviously, the user tables will be required to participate in these relationships.
Is there a way to keep the data separated whilst sti...
I read a mysql timestamp can only hold a value from 19700101000000 to sometime in the year 2037. I seriously doubt my app will be around then, well i'm sure it wont but any idea what will people use then for a timestamp, a text field?
Below is an example of how I currently insert a mysql record with a datetime mysql field and you can ...
I want to automatically add date in order_date field when a customer checkouts my online shop.
What is the best way to do it?
There are other fields like, delivery data and payment date in the same table.
Is it good idea to add a hidden field so that when a cutomer submit, the date will be added?
But I am not sure how to do it.
Can ...
My dilemma is that I am losing my ResultSet from the primary table when accessing a foreign key table. I need to save the results from the first table query while I query another table.
Scenerio:
I am implementing a recipe database system. Each recipe can have 1 to many ingredients. To resolve the 1 to many relationship, I created ...
Is there an equivalent to cron for MySQL?
I have a PHP script that queries a table based on the month and year, like:
SELECT * FROM data_2010_1
What I have been doing until now is, every time the script executes it does a query for the table, and if it exists, does the work, if it doesn't it creates the table.
I was wondering if I c...
i'm need to log some visits on my site to mysql and then parse them, such visits rate is about 50 per second. inserting each request is veryslow and bad, what can you advise me?
...
Hello all,
I am trying to save lots of variables to a database and its getting ridiculous now. I am using PHP and MySQL.
Is there a way, I can get the array value and the array keys (array keys are exactly saqme as the table column/field names) in one go without having to add a new variable and table column pair.
To be honest, I just ...