Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
I'm glad you found a solution to your problem-- how big a stick did it require? I actually learned a LOT just reading that thread (although I'm an Access guru who came to PHP/MySQL by way of conversion to zealotry, I've never used PHP against an Access back-end). Many thanks to those who contributed! In the meantime, a warning against CSV files: I've found it best, when transferring files this way, to use a delimiter other than the comma. I'll usually use a character that's not even on the keyboard, if possible. The other option is to make absolutely sure that all quotes in text fields (if any) are escaped/encoded. Either way works, you just have to be careful... -Mike Forbes Alex Gemmell wrote: Well, I have reached a solution that works brilliantly - unfortunately it doesn't involve connecting to the MS Access db file. Instead I have beaten the server administrator with a stick (harassing by phone works!) until he installed MySQL for me. Now I can work with PHP&MySQL in harmony! Thanks to all who offered help. Especially the last few ideas about using PHP to parse .csv files. That would have definitely been the only solution given my situation. Until the next impossible situation... Alex ¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦ |-Original Message- |From: Kosala Atapattu [mailto:[EMAIL PROTECTED] |Sent: 13 May 2004 05:09 |To: Alex Gemmell; PHP List |Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :( | |Hi Alex, | |Assuming that I understood your situation I'll make this suggestion. I'm |not sure whether this option is supported in you PHP version but I think |it'll be definitely available after (and with) 5.0. | |There are new function series called Sqlite (www.sqlite.org), an embded |file based SQL driver which supports SQL-92. As I see, this will be the |best substitute for Access MDB, on Linux platforms. From what I've tried |sqlite is much faster and much stable than MS Access. | |This would've been the ideal solution if your PHP version is supported. If |not the case still U can stick to Flat File based or CSV based data |solutions (U'll have to mess up lot with PHP :)). | |Regards, | |Kosala | |-Original Message- |From: Alex Gemmell [mailto:[EMAIL PROTECTED] |Sent: Wednesday, May 12, 2004 6:12 PM |To: PHP List |Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :( | |Hello all, | |I am fairly new to Linux/PHP so please bear with me. I have an awfully |awkward problem to solve - a stop gap solution for the next 6 months until |we have out in-house servers set up and running. I also have a very short |timeframe to sort this out. I am using PHP on a remotely hosted Linux web |server to build my website, however I have been given a MS Access database |to use! Despite my best efforts (and two days Google trawling) I haven't |found a suitable solution so I am turning to your collective knowledge... | |First things first - I do not run the server and cannot install any new |tools on to it (I cannot access the folders above my web root). There are |lots of suggestions on the net about installing MDBTools and UnixODBC RPM |(http://bryanmills.net:8086/archives/99.html) - but that involves the |admin who won't do it! I can, of course, put scripts that may help in the |actual web folder and reference them if anyone has any ideas... | |I know I must use a DSN-less connection. I first tried connecting directly |to the mdb file using: | $conn = new COM("ADODB.Connection") or die ("Cannot create ADODB |Connection object."); | | //$connstr = |"PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;"."DRIVER={Microsoft Access Driver |(*.mdb)};" | //$connstr = "Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=". |realpath("prices/mydb.mdb") ." ;"; | // I've never got the above two connection strings to work but I |include them for completeness and in case any realises they might help me! | $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". |realpath("prices/mydb.mdb") ." ;"; | | $conn->open($connstr); | |This worked on my localhost running IIS 5 (unsurprisingly) but fell over |immediately on the Linux box. I am told this is because COM support in PHP |before version 4.3.x is buggy (he PHP version installed on the server is |4.1.2). Is this true? Will upgrading to version 4.3.x solve all my |problems? | |Also, I heard that converting the .mdb file to a .dbf file might help - but |how do I connect to that with PHP? The PHP manual says this about dbase |functions: |"These functions allow you to access records stored in dBase-format (dbf) |databases. There is no support for indexes or memo fields." |That's no good because I have long text fields in the Access database that |are of type "memo"! |The Manual also says "we recommend that you do not use dBase files as your |production database" - eek! It's only a small database (one table with |about 50 records, each with no more than 20 fields) so hopefully it will |suffice. | |Am I right in thinking I have very few op
Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
I'm glad you found a solution to your problem-- how big a stick did it require? I actually learned a LOT just reading that thread (although I'm an Access guru who came to PHP/MySQL by way of conversion to zealotry, I've never used PHP against an Access back-end). Many thanks to those who contributed! In the meantime, a warning against CSV files: I've found it best, when transferring files this way, to use a delimiter other than the comma. I'll usually use a character that's not even on the keyboard, if possible. The other option is to make absolutely sure that all quotes in text fields (if any) are escaped/encoded. Either way works, you just have to be careful... -Mike Forbes Alex Gemmell wrote: Well, I have reached a solution that works brilliantly - unfortunately it doesn't involve connecting to the MS Access db file. Instead I have beaten the server administrator with a stick (harassing by phone works!) until he installed MySQL for me. Now I can work with PHP&MySQL in harmony! Thanks to all who offered help. Especially the last few ideas about using PHP to parse .csv files. That would have definitely been the only solution given my situation. Until the next impossible situation... Alex ¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦ |-Original Message- |From: Kosala Atapattu [mailto:[EMAIL PROTECTED] |Sent: 13 May 2004 05:09 |To: Alex Gemmell; PHP List |Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :( | |Hi Alex, | |Assuming that I understood your situation I'll make this suggestion. I'm |not sure whether this option is supported in you PHP version but I think |it'll be definitely available after (and with) 5.0. | |There are new function series called Sqlite (www.sqlite.org), an embded |file based SQL driver which supports SQL-92. As I see, this will be the |best substitute for Access MDB, on Linux platforms. From what I've tried |sqlite is much faster and much stable than MS Access. | |This would've been the ideal solution if your PHP version is supported. If |not the case still U can stick to Flat File based or CSV based data |solutions (U'll have to mess up lot with PHP :)). | |Regards, | |Kosala | |-Original Message- |From: Alex Gemmell [mailto:[EMAIL PROTECTED] |Sent: Wednesday, May 12, 2004 6:12 PM |To: PHP List |Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :( | |Hello all, | |I am fairly new to Linux/PHP so please bear with me. I have an awfully |awkward problem to solve - a stop gap solution for the next 6 months until |we have out in-house servers set up and running. I also have a very short |timeframe to sort this out. I am using PHP on a remotely hosted Linux web |server to build my website, however I have been given a MS Access database |to use! Despite my best efforts (and two days Google trawling) I haven't |found a suitable solution so I am turning to your collective knowledge... | |First things first - I do not run the server and cannot install any new |tools on to it (I cannot access the folders above my web root). There are |lots of suggestions on the net about installing MDBTools and UnixODBC RPM |(http://bryanmills.net:8086/archives/99.html) - but that involves the |admin who won't do it! I can, of course, put scripts that may help in the |actual web folder and reference them if anyone has any ideas... | |I know I must use a DSN-less connection. I first tried connecting directly |to the mdb file using: | $conn = new COM("ADODB.Connection") or die ("Cannot create ADODB |Connection object."); | | //$connstr = |"PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;"."DRIVER={Microsoft Access Driver |(*.mdb)};" | //$connstr = "Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=". |realpath("prices/mydb.mdb") ." ;"; | // I've never got the above two connection strings to work but I |include them for completeness and in case any realises they might help me! | $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". |realpath("prices/mydb.mdb") ." ;"; | | $conn->open($connstr); | |This worked on my localhost running IIS 5 (unsurprisingly) but fell over |immediately on the Linux box. I am told this is because COM support in PHP |before version 4.3.x is buggy (he PHP version installed on the server is |4.1.2). Is this true? Will upgrading to version 4.3.x solve all my |problems? | |Also, I heard that converting the .mdb file to a .dbf file might help - but |how do I connect to that with PHP? The PHP manual says this about dbase |functions: |"These functions allow you to access records stored in dBase-format (dbf) |databases. There is no support for indexes or memo fields." |That's no good because I have long text fields in the Access database that |are of type "memo"! |The Manual also says "we recommend that you do not use dBase files as your |production database" - eek! It's only a small database (one table with |about 50 records, each with no more than 20 fields) so hopefully it will |suffice. | |Am I right in thinking I have very few op
Re: [PHP-DB] Edit with notepad
Why not just provide them with two different links to the document-- one version includes the tag, the other doesn't. -Mike Forbes Ng Hwee Hwee wrote: hi, header("Content-type: application/vnd-ms.word"); is not what my customers want. They may or may not want to save it in their harddisk.. but having the header at the beginning of my page will force them to save it in their harddisk. Some of the customers just want to view it on the web while others want to view it in Word and possibly edit it and then save it.. how can i achieve such flexibility for them? thank you!! regards, hwee - Original Message - From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, May 11, 2004 2:25 AM Subject: [PHP-DB] Re: Subject: Edit with notepad Send before any content, an MS-Word header : header("Content-type: application/vnd-ms.word"); Then output your HTML. Cheers - Neil. At 07:41 10/05/2004 +, you wrote: Message-ID: <[EMAIL PROTECTED]> From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Date: Mon, 10 May 2004 15:40:27 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_NextPart_000_00D2_01C436A5.1E3B4100" Subject: Edit with notepad Hi My customers would like to save my php outputs in a word document file and so I have added a meta tag in my php files. However, my File->Edit button in IE6 is greyed out. why? i see that other php files on other websites allow Edit, why is it that my programs don't allow it?? thanx for any insights!! regards, Hwee Hwee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: upload files into MySQL database
I've not run into this problem before, but the solution seems obvious: replace your filename spaces with underscores, or get rid of them completely. -Mike Forbes Phpdiscuss - Php Newsgroups And Mailing Lists wrote: Hello, I have problem for downloading files from MySQL database. Although I store and I see the filename and the extension in the database, when I try to download it, if there are blank spaces inside the filename, like "my book store.doc" I cannot open it and see it. Best regards Stelios Karapas email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] question on
Interesting idea. Since I'm convinced that javascript is the bastard offspring of Bill Gates, Larry Ellison, and Baalzebub, can I sue too? :) Hengameh wrote: Well I am suing Java script to capture the selected item and make it the value of my input box. But my problem is how to access this information from this point on. Can someone please tell me how I can use the selected item in my next SQL query? -Original Message- From: Tony S. Wu [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 11:07 AM To: hengameh Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] question on sounds like a job for JavaScript. Tony S. Wu [EMAIL PROTECTED] "Look into the right places, you can find some good offerings." http://homepage.mac.com/tonyswu/stw- The perfect business. http://homepage.mac.com/tonyswu/tonyswu- My web page. --- On May 12, 2004, at 7:02 AM, hengameh wrote: Hello, I am very new to php and mysql so please be patient with me. I don't even know if I am using the right listing, but I hope someone can help me! I need to create a and the possible options are from my mysql database ( so far so good, I was able to find code to do that). Now I need to use the user selected option to drive the options of me next . I need to know how to capture what user selected and how to pass that around? I have used "onchange" attribute of the to capture the selected line but now how can I pass that to other php scripts? ( I need to get the name of the country so that I can show a list of possible state/province. I setting the value of the "newcountry" input to the selected "country" but when I do echo $newcountry in quicksearch.php, its blank!!) Please help!! Thanks so much Here is what I have so far: Quicksearch.php file has the following code Steps 1-4
Countrty_buil.php has the following require_once("util.php"); echo ""; // // initialize or capture the country variable $country = !isset($_REQUEST['country'])? "Select a country": $_REQUEST['country']; $countrySQL = !isset($_REQUEST['country'])? "*": $_REQUEST['country']; echo "$country"; $query = "SELECT country FROM ". TABLECOUNTRY . " ORDER BY country ASC"; // pconnect, select and query if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME, DBPASSWORD)) { if ( mysql_select_db(DBNAME, $link_identifier)) { // run the query $queryResultHandle = mysql_query($query, $link_identifier) or die( mysql_error() ); $ctrRows = mysql_num_rows($queryResultHandle); // row counter // if data exists then $rows will be 1 or greater if( $ctrRows == 0 ) { echo"No data found"; }else{ // build the select list while($row = mysql_fetch_object($queryResultHandle)) { // grab a row echo "country\">$row->country"; } echo ""; } }else{ // select echo mysql_error(); } }else{ //pconnect echo mysql_error(); } ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Dynamic Email Address in an HTML table
Two alternatives: One is to store the entire string "" in your field. The other is to just store the field, but concat the string together when you echo/print it. i.e.,: print ""; Phpdiscuss - Php Newsgroups And Mailing Lists wrote: Hello, I have a page displaying the results of a query from a mysql database. The final field displayed is an email address (in text datatype from the table). How can I create the email address in the field as a hyperlink to the email address? Since my query loops through the database and displayes a "row" per row in the db. EX: Field 1 Field 2EmailAddress Test Test [EMAIL PROTECTED] In the email address field, the address shows up as text, how can I create that as a mailto:[EMAIL PROTECTED] (or whatever the email address is). Thank you Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Delete records in an Access DB
Nope. Access' version of SQL is a slight bit different from ANSI SQL. All he needs to do in his statement is change it to this: $query="DELETE * FROM Test_Table WHERE name='franco';"; (notice the wildcard in there-- Access isn't smart enough to realize that the deletion of any information in a row automatically means deleting the entire row. I guess the original design must've intended to use delete for an update = null.) -Mike Forbes Uzi Klein wrote: Match Case ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, May 02, 2004 09:19 To: [EMAIL PROTECTED] Subject: [PHP-DB] - Delete records in an Access DB Hi all, I have this problem: I want to delete records in an Access DB. I use this code: $query="DELETE FROM Test_Table WHERE name='franco';"; // the connection parameters $path="d:/inetpub/webs/my_site/mdb-database/" ; $db_name="test.mdb" ; $dsource=$path.$db_name ; $cn_string="Provider=Microsoft.Jet.OLEDB.4.0;" ; $cn_string.="Data Source=$dsource;" ; // connection $cn=new COM("ADODB.Connection"); $cn->open($cn_string); // object Recordset and send query by Open() metod $rs=new COM("ADODB.Recordset") ; $rs->open($query,$cn) ; // clean Recordset object $rs->Release() ; $rs=null ; /* close connection */ $cn->Close() ; $cn->Release() ; $cn=null ; but I have this error message: Fatal error: Call to undefined function: open() in D:\Inetpub\webs\metagenonlinecom\canc.php on line 11 Where is the problem? Is this the correct way to delete records from an Access DB? If this is a bad tecnic, can you suggest me what is the correct way? Thanks in advance to all. (The server where this script run is a Microsoft server). Francesco -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: The usual problem
If your ID is an autoincremented field, try not including it in your insert statement. I.E.: $sql = "INSERT INTO underskrifter (type, navn, epost, tid, ip, domain, sted) " . " VALUES ('$_POST[type]', '$_POST[navn]', '$_POST[epost]', '$tid', '$ip', '$host', '$_POST[sted]' );" -Mike Forbes Mathias hunskår furevik wrote: Whats worng with this? $sql = "INSERT INTO underskrifter (id, type, navn, epost, tid, ip, domain, sted) " . " VALUES ( '', '$_POST[type]', '$_POST[navn]', '$_POST[epost]', '$tid', '$ip', '$host', '$_POST[sted]' );" . " "; mysql_query($sql); ??? First I tryed the usual INSERT syntax, then the one that phpMyAdmin suggests. None of them works. - Mathias Norway -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: SQL question!
What you wrote will give you the list of users who also happen to have comments. What you really want is more like this: SELECT Users.ID, Users.UserName, Comments.Description FROM Users LEFT JOIN Comments ON Users.ID = Comments.UserID; (note that you'll need to have the UserID foreign key in your Comments table. Also, the "LEFT JOIN" phrase tells whatever sql back-end you're using that you want -all- records from the users table, regardless of whether or not they have a comment-- and any comments per user in the comments table. If you want to eliminate users who don't have comments, use an INNER JOIN instead. -Mike Forbes Bruno Braga wrote: Hey. I have these tables. Users ( id,name,etc ) Coments : ( id , comment ) How do I do this kind of query: I thought in one thing like this but I cant figure it out. Example: Select * from users order by id desc in (select count (id) from comments) Expected result: List of users: * User1 See comments ( 32 comment in database ) * User2 See coments (13 comments in database ) * etc. thanks in advanced. Bruno -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Delete records in an Access DB
Heh, yeah, I didn't read far enough-- and boy do I feel like a troll now. My apologies, case inconsistencies probably are causing his problem-- but he'll also have a problem with the SQL statement when it gets that far, if he doesn't tell it what to delete (i.e., wildcard), simply b/c that's the way Access behaves. -Mike Forbes Uzi Klein wrote: [EMAIL PROTECTED] wrote : Fatal error: Call to undefined function: open() in D:\Inetpub\webs\metagenonlinecom\canc.php on line 11 I assume the error is match case in open function... Should be $db->Open... etc. -Original Message----- From: Michael Forbes [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 07:00 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] - Delete records in an Access DB Nope. Access' version of SQL is a slight bit different from ANSI SQL. All he needs to do in his statement is change it to this: $query="DELETE * FROM Test_Table WHERE name='franco';"; (notice the wildcard in there-- Access isn't smart enough to realize that the deletion of any information in a row automatically means deleting the entire row. I guess the original design must've intended to use delete for an update = null.) -Mike Forbes Uzi Klein wrote: Match Case ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, May 02, 2004 09:19 To: [EMAIL PROTECTED] Subject: [PHP-DB] - Delete records in an Access DB Hi all, I have this problem: I want to delete records in an Access DB. I use this code: $query="DELETE FROM Test_Table WHERE name='franco';"; // the connection parameters $path="d:/inetpub/webs/my_site/mdb-database/" ; $db_name="test.mdb" ; $dsource=$path.$db_name ; $cn_string="Provider=Microsoft.Jet.OLEDB.4.0;" ; $cn_string.="Data Source=$dsource;" ; // connection $cn=new COM("ADODB.Connection"); $cn->open($cn_string); // object Recordset and send query by Open() metod $rs=new COM("ADODB.Recordset") ; $rs->open($query,$cn) ; // clean Recordset object $rs->Release() ; $rs=null ; /* close connection */ $cn->Close() ; $cn->Release() ; $cn=null ; but I have this error message: Fatal error: Call to undefined function: open() in D:\Inetpub\webs\metagenonlinecom\canc.php on line 11 Where is the problem? Is this the correct way to delete records from an Access DB? If this is a bad tecnic, can you suggest me what is the correct way? Thanks in advance to all. (The server where this script run is a Microsoft server). Francesco -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php