RE: [PHP-DB] PHP MySQL: temporary table problem
Hi. I would like to know, if there is any change to export/import data from SQL/EXCEL/SQL with php??? It?s very important. So if someone knows a way please help me. HeHe ... I don't know how this is related to my question, but. To import directly in Excel from MySQL, you can use MyODBC (I sugest you to use development version). If you want just to export from Excel and iport into MySQL, just do an DOS (I think that .csv) export of data and try using LOAD DATA INFILE (check mysql options how to set a field separator ... you will easly set this in excel export),... If anyone want to check my question, see below ;) I got a task to program a search engine for a site which is all around based on sessions and persistent connections to MySQL. The problem is that I first have to select a subset of those data and then I have to join them all around and output results. I'm using temporary tables for this but there is a problem. Temporary tables are visible trough the entire connection. So in future one browser window can interact (can display) with results from another browser window. Does anyone have a sugestion how to solve this? I was thinking to close a persistent connection (I don't know how???) on each result page at the begining and then reopen it at the end ... for my code I was thinking on using normal connections. Any better idea? I thik I just can't live without temporary tables till I will not have subqueryes. Regards, Dezo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] QUERY question (group by) - please help
Hi. Maybe this isn't the correct list for asking the below question (if so sorry ;) ). I want to calculate how many rows my MySQL query which uses 'GROUP BY' returns. The query: SELECT something FROM test WHERE (kid=1) OR (kid=2) OR (kid=4) GROUP BY cid,aid; Is it posible to get number of rows with such a query from MySQL v3.23.49? If it isn't posible ... is it posible in MySQL 4.x? I think a lot about this problem and I realize only the following solution (to avoid returning a lot of rows in PHP): CREATE TEMPORARY TABLE t (i INT); INSERT INTO t (i) SELECT aid FROM the_query_above SELECT COUNT(*) FROM t; DROP TABLE t; But this isn't so elegant. I want to do so on data generated by: CREATE TABLE test ( kid INT, aid INT, cid INT ); INSERT INTO test (kid, aid, cid) VALUES ( 1, 0, 1), ( 2, 2, 2), ( 1, 3, 2), ( 2, 3, 2), ( 4, 4, 2), ( 4, 0, 3), ( 3, 3, 4), ( 4, 3, 4); Regards, Dezo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php