[PHP-DB] Problem with PHP ODBC
Hi, I try to configure a web server under Debian/GNU/Linux Sarge. All fonctionning perfectly except odbc connect. I have to read datas in an ACCESS2000 mdb file to import in Mysql. Actually this run correct under a windows 2000 workstation with apache/PHP/Mysql I installed on my debian odbc tools and odbcinst. Under Linux i have an error in /var/log/apache/error.log Can't alloc filename Unable to locate database /var/www/foo.mdb I tried to relax permissions on my file foo.mdb (chmod 777) but i have the same error. Ideas ? Olivier FONTES Bad English speaking frenchie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Losing MySQL connection with multiple database classes
Hello all. I'm getting a weird problem trying to use a database class for multiple connections for different databases on the same server. Whenever I make a new instance of the class, all the previously opened class instances connect to that new MySQL database. So, for example, if I have something like..: -8- $dbcon1 = new databaseclass($server1,$user1,$pass1,$database1); $dbcon1-connect(); $dbcon1-query($sql); $dbcon2 = new databaseclass($server2,$user2,$pass2,$database2); $dbcon2-connect(); $dbcon2-query($another_sql); $dbcon1-query($yet_another_sql); -8- the last query doesn't work since $dbcon1 seems to point now to the same database as $dbcon2, and by all that I have read this shouldn't be happening... should it? Please, help is appreciated very much. -Mika Porspakka -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Losing MySQL connection with multiple database classes
Check your class... Maybe it resets the connection each time you create it. -Original Message- From: Mika Porspakka [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 12:23 To: [EMAIL PROTECTED] Subject: [PHP-DB] Losing MySQL connection with multiple database classes Hello all. I'm getting a weird problem trying to use a database class for multiple connections for different databases on the same server. Whenever I make a new instance of the class, all the previously opened class instances connect to that new MySQL database. So, for example, if I have something like..: -8- $dbcon1 = new databaseclass($server1,$user1,$pass1,$database1); $dbcon1-connect(); $dbcon1-query($sql); $dbcon2 = new databaseclass($server2,$user2,$pass2,$database2); $dbcon2-connect(); $dbcon2-query($another_sql); $dbcon1-query($yet_another_sql); -8- the last query doesn't work since $dbcon1 seems to point now to the same database as $dbcon2, and by all that I have read this shouldn't be happening... should it? Please, help is appreciated very much. -Mika Porspakka -- 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] Losing MySQL connection with multiple database classes
Oh damn. The class was missing the link identifier in one of the functions and that reset the rest of the class instances too. Thanks, probably would have taken hours before i had taken a look at the class.. Check your class... Maybe it resets the connection each time you create it. -Original Message- From: Mika Porspakka [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 12:23 To: [EMAIL PROTECTED] Subject: [PHP-DB] Losing MySQL connection with multiple database classes Hello all. I'm getting a weird problem trying to use a database class for multiple connections for different databases on the same server. Whenever I make a new instance of the class, all the previously opened class instances connect to that new MySQL database. So, for example, if I have something like..: -8- $dbcon1 = new databaseclass($server1,$user1,$pass1,$database1); $dbcon1-connect(); $dbcon1-query($sql); $dbcon2 = new databaseclass($server2,$user2,$pass2,$database2); $dbcon2-connect(); $dbcon2-query($another_sql); $dbcon1-query($yet_another_sql); -8- the last query doesn't work since $dbcon1 seems to point now to the same database as $dbcon2, and by all that I have read this shouldn't be happening... should it? Please, help is appreciated very much. -Mika Porspakka -- 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] Problem with PHP ODBC
If you are able to place the Access database on a Windows machine that can be accessed by the Linux machine, then you can use odbtp. You can get it at http://odbtp.sourceforge.net. -- bob On Wed, 5 May 2004 [EMAIL PROTECTED] wrote: Hi, I try to configure a web server under Debian/GNU/Linux Sarge. All fonctionning perfectly except odbc connect. I have to read datas in an ACCESS2000 mdb file to import in Mysql. Actually this run correct under a windows 2000 workstation with apache/PHP/Mysql I installed on my debian odbc tools and odbcinst. Under Linux i have an error in /var/log/apache/error.log Can't alloc filename Unable to locate database /var/www/foo.mdb I tried to relax permissions on my file foo.mdb (chmod 777) but i have the same error. Ideas ? Olivier FONTES Bad English speaking frenchie -- 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] Struggling
--- Erik Meyer [EMAIL PROTECTED] wrote: Hope someone can help me. I have two tables: evt_details evt_sponsors The structure is as follows: evt_details evt_sponsors evt_detail_id (INT)(PK) evt_sponsor_id (INT)(PK) evt_detail_title (CHAR) evt_sponsor_name (CHAR) evt_sponsor_id1 (INT) NON-NULL evt_detail_date (date) evt_sponsor_id2 (INT) NULL evt_sponsor_id3 (INT) NULL evt_sponsor_id4 (INT) NULL Now, the event can have either 1 sponsor, 2 sponsors, 3 sponsors, or 4 sponsors. Is there a way where I can return a result whether it has 1, 2, 3, or 4 since some of the events will not have a 2d,3d, or 4th sponsor, a combination of 1 2, 1,2,3, or all 4 depending on the values in the table? You _could_ normalize the data a bit more and use a lookup table with a separate line for each event/sponsor combination. The event table would have event details, the sponsor table would have sponsor details, and the lookup table would simply be a cross reference using the IDs. Something like this: Evt_Sponsor: event_id sponsor_id 1 1 1 2 1 3 1 4 2 1 2 2 2 3 3 3 3 4 4 2 This shows four events: one with 4 sponsors, one with 3, one with 2, and one with 1. Then you can use the lookup table to query on the events/sponsor combiantions that exist. Here is the query I have: SELECT e.evt_detail_title, a.evt_sponsor_name, b.evt_sponsor_name, c.evt_sponsor_name, d.evt_sponsor_name FROM evt_sponsors a, evt_sponsors b, evt_sponsors c, evt_sponsors d, evt_details e WHERE e.evt_detail_date = DATE_SUB(NOW(), INTERVAL 1 DAY) AND e.evt_sponsor_id1=a.evt_sponsor_id AND (e.evt_sponsor_id2=b.evt_sponsor_id OR e.evt_sponsor_id2=0) AND (e.evt_sponsor_id3 =c.evt_sponsor_id OR e.evt_sponsor_id3=0) AND (e.evt_sponsor_id4=d.evt_sponsor_id OR e.evt_sponsor_id4 =0) Thanks for the help, Erik W. Meyer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PHP ODBC
I try to configure a web server under Debian/GNU/Linux Sarge. All fonctionning perfectly except odbc connect. I have to read datas in an ACCESS2000 mdb file to import in Mysql. Actually this run correct under a windows 2000 workstation with apache/PHP/Mysql I installed on my debian odbc tools and odbcinst. Under Linux i have an error in /var/log/apache/error.log Can't alloc filename Unable to locate database /var/www/foo.mdb I tried to relax permissions on my file foo.mdb (chmod 777) but i have the same error. Ideas ? Olivier FONTES Bad English speaking frenchie Selon Robert Twitty [EMAIL PROTECTED]: If you are able to place the Access database on a Windows machine that can be accessed by the Linux machine, then you can use odbtp. You can get it at http://odbtp.sourceforge.net. -- bob My problem is i can't modify my PHP code. Actually the web site runs on a windows2000 workstation and odbc work fine, y want to port this website with minimal modifications on a linux machine. I don't have time to code another system to import my access database. Olivier FONTES -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Fatal Problem of PHPMSSQL
Hi, I found a big problem of mssql dll. I have 2 servers A(WinXP Pro_CN) and B(Win2000 Pro_CN).I am in China. IIS(Configed PHP) are on both servers. SQL Server are on server A. Just use mssql_connect($host,$user,$pass)to connect to the SQL Server. After I installed the WindowsXP-KB835732-x86-CHS.EXE(patch to Anti Virus W32.Sasser.B.Worm),the function run on server B can't login the SQL Server on A.I have used 'netstat' cmd on WinXP,it pointed that connection was established,but login failed.I tried the function on few other IIS Servers,all failed.But it's OK on Server A. It's OK of other connections.I can login success use ASP,but PHP failed. SQL Server run on Win2000 Pro is not affected by the patch,all connections are OK. So, I think it's the patch that cause the login failure.But ASP can login the server properly,just PHP fail,so PHP should change the connection function, i think. You can test the function on your servers. HELP! yours beforefly -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PHP ODBC
If you are able to place the Access database on a Windows machine that can be accessed by the Linux machine, then you can use odbtp. You can get it at http://odbtp.sourceforge.net. -- bob My problem is i can't modify my PHP code. Actually the web site runs on a windows2000 workstation and odbc work fine, y want to port this website with minimal modifications on a linux machine. I don't have time to code another system to import my access database. Then this may be difficult for you. Open source ODBC support for MS Access on Linux is only available with MDB Tools. Depending on what you are doing, it may not behave the same as the MS Access ODBC driver on Windows. If you were using a DB abstraction library like ADODb or PEAR DB, then porting would not be difficult. IF you cannot get MDB Tools to work, you may need to find a commercial MS Access ODBC driver that works on Linux. Take a look at http://bryanmills.net:8086/archives/99.html. It shows you how to configure MDB Tools and unixODBC to work with PHP. -- bob Olivier FONTES -- 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] Subject: Struggling [Is : With database normalisation]
Probably something as simple as changing the structure to a more normalised form would help : By adding a table which links evt_details to evt_sponsors, you do away with the need to have (up to 4) distinct fields to hold the evt_sponsor in your evt_details table. So add something like table : `evt_sponsors_list` `evt_detail_link_id`INT 6 `evt_sponsor_link_id` INT 6 Then your query becomes more like : SELECT evt_detail_id, evt_detail_title, evt_sponsor_name FROM evt_details LEFT JOIN evt_sponsors_list ON evt_detail_id=evt_detail_link_id LEFT JOIN evt_sponsors ON evt_sponsor_link_id=evt_sponsor_id WHERE evt_detail_date = DATE_SUB(NOW(), INTERVAL 1 DAY) The left join evt_sponsors_list will pull any number (1-many) of results where there is one or more matching sponsor. The left join evt_sponsors will then match those results to the evt_sponsors table, resulting in a series of rows for each event. You could change the 1st join to read 'LEFT OUTER JOIN' if you wanted to get events where there are *no* sponsors (what you were previously doing with `OR e.evt_sponsor_id_n =0`) This is a one-to-many relationship and allows you to have flexibility for any number of event sponsors (not just 4) without adding more and more fields to your event_detail table. Make sure to index both columns in the evt_detail_link table for good performance, and the storage overhead is almost neglible. You can then run a simple loop in PHP, cache the new row each time the evt_detail_id changes (containing the event title, the ID is useful so you can link to full details by event_id if you need to). Then for the 1st and subsequent rows, just use the evt_sponsor_name. Output the previous row when the evt_detail_id changes, and output the final row when there are no more results. Cheers - Neil. At 22:24 04/05/2004 +, you wrote: PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php From: Erik Meyer [EMAIL PROTECTED] To: PHP-DB [EMAIL PROTECTED] Date: Tue, 4 May 2004 17:24:59 -0500 Message-ID: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Subject: Struggling Hope someone can help me. I have two tables: evt_details evt_sponsors The structure is as follows: evt_details evt_sponsors evt_detail_id (INT)(PK) evt_sponsor_id (INT)(PK) evt_detail_title(CHAR) evt_sponsor_name (CHAR) evt_sponsor_id1 (INT) NON-NULL evt_detail_date (date) evt_sponsor_id2 (INT) NULL evt_sponsor_id3 (INT) NULL evt_sponsor_id4 (INT) NULL Now, the event can have either 1 sponsor, 2 sponsors, 3 sponsors, or 4 sponsors. Is there a way where I can return a result whether it has 1, 2, 3, or 4 since some of the events will not have a 2d,3d, or 4th sponsor, a combination of 1 2, 1,2,3, or all 4 depending on the values in the table? Here is the query I have: SELECT e.evt_detail_title, a.evt_sponsor_name, b.evt_sponsor_name, c.evt_sponsor_name, d.evt_sponsor_name FROM evt_sponsors a, evt_sponsors b, evt_sponsors c, evt_sponsors d, evt_details e WHERE e.evt_detail_date = DATE_SUB(NOW(), INTERVAL 1 DAY) AND e.evt_sponsor_id1=a.evt_sponsor_id AND (e.evt_sponsor_id2=b.evt_sponsor_id OR e.evt_sponsor_id2=0) AND (e.evt_sponsor_id3 =c.evt_sponsor_id OR e.evt_sponsor_id3=0) AND (e.evt_sponsor_id4=d.evt_sponsor_id OR e.evt_sponsor_id4 =0) Thanks for the help, Erik W. Meyer CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php