Re: [PHP-DB] mysql to cvs file to excel
This is what I use to generate a comma delimited csv file: $sql = SELECT * FROM table INTO OUTFILE 'file.csv' . FIELDS TERMINATED BY \',\' . ENCLOSED BY \'\\'; Hope this helps. Ruth - Original Message - From: Snijders, Mark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 21, 2003 8:59 PM Subject: [PHP-DB] mysql to cvs file to excel hello, does anybody know if it's possible (without php) to export data from mysql to a cvs file, so i can import it in excel??? so is it possible, and if yes.. how? thanks kinds regards, Mark Snijders -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] dump data, and save as a file
Hi everyone, I want to dump some data from mysql into a file, and use php to force the browser to pop a download file window. This seems a simple procedure, but I am having trouble to make it work with IE. The following is what I did: ob_start(); $query = SELECT * FROM table; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { echo $row['data']; } header(Cache-control: private); header(Content-Type: application/txt); header(Content-Disposition: attachment; filename=test.txt); //Note: I also tried: header(Content-Disposition: inline; filename=test.txt); ob_end_flush(); * It seems OK with Netscape, but with IE, all I got is all data displayed on the screen even with ob_start(). I also tried echo the data after header(), I have the same result. I have spent a long time on this, and searched for information on www.php.net, but can not find an answer. Your help is highly appreciated. Thanks in advance. Ruth
Re: [PHP-DB] Linux+php+remote MS SQL
John, Thank you so much for your response to my post. As I mentioned before, a few things in this project are new to me: remote access, MS SQL and SSL. Your experience gives me more confidence although I still have a lot to learn. I am sure I will need people's help here later on. Thanks again. Thank php-db list too. Ruth - Original Message - From: John Krewson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, December 14, 2002 3:06 AM Subject: Re: [PHP-DB] Linux+php+remote MS SQL We are currently running two report generation applications where PHP is running on Linux machines and queries data from Windows NT servers running MSSQL 7.0 We have reports that deal with millions of records, and whether they run for 4 minutes or 20, I have only seen robust results from the PHP/MSSQL combination. (I know, 20 minutes is a long time...I didn't say that all of my SQL statements were robust (-: ) Regarding remote access to SQL server 7, as far as I know the only way to access SQL Server remotely is from another machine also running SQL server. From SQL Server Enterprise Manager you can add databases to access, setting the login properties to either use Windows authentication or SQL server authentication. SQL Server has great documentation, their Books Online, and is, I believe, a pretty easy app to figure out. Remotely you can add databases, change users, run queries, etc...again the only downside is that you need to be on windows running SQL Server on the client. I've looked for a remote SQL Server tool that could run on OSX or Linux, but have not yet found one that meets all my needs...anyone? You asked if your setup will slow down the application. I have to ask, is the DB server going to be behind a firewall? I'm no networking guru, but we had some speed issues initially when our DB server was behine the firewall and the apache server was not. It seemed to me that there was time spent moving data back and forth, as now that we have both machines behind the firewall things have speeded up considerably. The real lesson I learned, however, was to make every connection count, as in get as much data as possible per query and lean on the Linux box to process, sort, count, etc if I could rather than getting a small chunk of data, going back to the DB, etc etc. Considering how easy it is to remotely administer a Linux machine, it's too bad you can't have it with the DB machine. I'm not quite sure what you mean by your last question regarding PHP's mssql functions vs. ODBC. I do not and have never used ODBC to connect PHP to SQL Server, although in our situation I think it would add a layer of complexity and possibly slow things down a bit, but that's just a guess. I'm assuming you were asking if using connecting via ODBC is slower. See: http://www.php.net/manual/en/function.mssql-connect.php http://www.phpbuilder.net/columns/alberto2919.php3 for more specific info regarding setup and mssql libraries. Hope this was helpful. Once you get started you should be able to find plenty of info in the php-db mailing list archive regarding how to make this setup work. Ruth Zhai wrote: Hi Everyone, I have spent a few hours searching on the internet, but still can not get the information I need. So I turn to you for help. I will be doing a web site which has a lot of data from a remote mssql server. The scripts will be in php and run on Linux. As requirements, the mssql will stay at the client's internal network, and linux server will be right here with me. For your information, we are considering using broad band connection for the web server although this has not been finalized. The web site will initially have 3000 clients, and the db will be updated on daily basis. For me, this is challenge because this is the first time for me to use remote db server, first time to use mssql server and first time to use combination of open source and MS products. Forgive me if I don't ask proper questions. The followings are my questions: 1. Will this combination cause a lot of problems? Will it be stable enough? 2. Because the db server is not connected to the internet, I am not sure what options I have in terms of connection to the db. Would some one point me a direction or tutorial about this? 3. Will remote access slow down the application a lot? 3. PHP has functions for mssql. Does any one know how those compare with ODBC? I would appreciate if you could share your experience with me or give me your opinion on the above issues. Thank you very much in advance. Ruth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Linux+php+remote MS SQL
Hi Everyone, I have spent a few hours searching on the internet, but still can not get the information I need. So I turn to you for help. I will be doing a web site which has a lot of data from a remote mssql server. The scripts will be in php and run on Linux. As requirements, the mssql will stay at the client's internal network, and linux server will be right here with me. For your information, we are considering using broad band connection for the web server although this has not been finalized. The web site will initially have 3000 clients, and the db will be updated on daily basis. For me, this is challenge because this is the first time for me to use remote db server, first time to use mssql server and first time to use combination of open source and MS products. Forgive me if I don't ask proper questions. The followings are my questions: 1. Will this combination cause a lot of problems? Will it be stable enough? 2. Because the db server is not connected to the internet, I am not sure what options I have in terms of connection to the db. Would some one point me a direction or tutorial about this? 3. Will remote access slow down the application a lot? 3. PHP has functions for mssql. Does any one know how those compare with ODBC? I would appreciate if you could share your experience with me or give me your opinion on the above issues. Thank you very much in advance. Ruth
Re: [PHP-DB] mysql - enum
This is what I use: SHOW COLUMNS FROM table LIKE field I use the query result for a select field in HTML table. Ruth - Original Message - From: Bastian Vogt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 02, 2002 11:41 PM Subject: [PHP-DB] mysql - enum Hi, is it possible to get all possible values of an enum-field from a mysql-table in php? The values might be changed in the database. Now I've got an select-field in my php-app where the user can select each value of the enum-field for a new record befor saving... Thanks for any reply, Bastian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sessions tutorial
This is a very good tutorial about authentication using PHP and MySQL. If you don't use database, you may still learn some thing about sessions from there: http://phpcomplete.com/content.php?id=72 Ruth - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 11, 2002 3:54 AM Subject: [PHP-DB] sessions tutorial Sorry, Michael, I meant to send this to the list, not just to you. I apologize. Hello all, I am a php newbie and am currently developing my first php page. My page will allow several people to log in at the same time sharing access to the mysql db. SO, I need to use sessions. Does anyone know of a good tutorial on sessions to get me started? Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] access DB via PHP classes
Thank you again, Wilmar. As a newbie for OOP, I will keep my option open when I design this application. I have not come to a conclusion which way is better than another (I wish I had time to test all possibilities). I appreciate your comments, and will keep them in mind. Regards Ruth - Original Message - From: Wilmar Perez [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 12:10 AM Subject: Re: [PHP-DB] access DB via PHP classes Well, what about building a basic class without any database conection in the constructor and then have a inherited class with the needed database conection? and then use whichever you need to generate the pages. You can even just have the basic class and execute some code in the constructor that connects or not to the database depending on a parameter you pass to it. As I told you before, I'm very newbie to OOP as well, but think that may work well. Hope it helps Bye *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] access DB via PHP classes
Hi All, Although I am not so new to PHP (not expert either), this is the first time for me to use PHP class. I am starting a project, and plan to use partially OOP and partially traditional programming. I use PHP/MySQL. I have one class, DB_Do, which does every thing to do with database, and several other classes. When I start my design, I realized that very often, other classes need to access database, eg. I have an Access_Control class which controls all accesses to pages in the application. One of methods in this class is to authenticate the user login via user name and password stored in the database. I am not sure if I should use an object of DB_Do within the method of Access_Control or write separate code to access the database for the user name and password. It seems that I loose purpose of OOP if I write the separate code. However, I am not sure if creating the object within other class is efficient? I would appreciate if some one there could give me some suggestions about this. Thanks in advance. Ruth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] access DB via PHP classes
Thanks Wilmar, for sharing your experience with me. My problem now is that I have already got a class to do every thing related to database. If I don't use this DB class within other classes, I will have a lot of duplicated code. If I do use the DB class within other classes, I am not sure if it is efficient. Thanks again. Ruth - Original Message - From: Wilmar Perez [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 08, 2002 11:53 AM Subject: Re: [PHP-DB] access DB via PHP classes Well, I'll tell you what I do. I'm not a OOP expert so if someone feel like I'm doing it wrong I'll welcome any comment about . I've got a main class which I use to generate every page in my website (some are actually generated by inherited classes but that's the main idea). As I need a database conection for every page I write the connection threat in the main class constructor using mysql_pconnect which handles a persistent connection. So far it is workin alright for me. As I said before any comments will be welcome. Hope it helps *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi All, Although I am not so new to PHP (not expert either), this is the first time for me to use PHP class. I am starting a project, and plan to use partially OOP and partially traditional programming. I use PHP/MySQL. I have one class, DB_Do, which does every thing to do with database, and several other classes. When I start my design, I realized that very often, other classes need to access database, eg. I have an Access_Control class which controls all accesses to pages in the application. One of methods in this class is to authenticate the user login via user name and password stored in the database. I am not sure if I should use an object of DB_Do within the method of Access_Control or write separate code to access the database for the user name and password. It seems that I loose purpose of OOP if I write the separate code. However, I am not sure if creating the object within other class is efficient? I would appreciate if some one there could give me some suggestions about this. Thanks in advance. Ruth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Global variables, $_GET problem
Hello php friends, We just upgraded our PHP to version 4.2.1. I realized that $var is no longer available from www.url.com/myphp.php?var=3 . As instructed in the document, we have tried two things: 1. I tried to use $_GET('var'), however, I got Fatal error: Call to undefined function: array() in /home/httpd/... message. I have no clue what this means, and what I have done wrong. 2. Set register_globals = on in the configuration file. This did not make any difference. I don's know what to do now. Your help is highly appreciated. Ruth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php