Re: [PHP-DB] setting SQL variable

2007-01-18 Thread Bruce Cowin
What about doing all of that in a stored proc and handle the transaction in there? I've never done that with MySQL (only SQL Server) but I'm assuming it's possible. Regards, Bruce >>> marga <[EMAIL PROTECTED]> 18/01/2007 10:37:04 p.m. >>> Hi, I create a sql variable with php code. Is possib

Re: [PHP-DB] Creating drop down lists

2007-03-11 Thread Bruce Cowin
Your select is only selecting the field 'root' but then you're trying to get the field 'username' in your while loop. So, you can add username to your select (or change it to *): select root, username from training select * from training Regards, Bruce >>> Scott <[EMAIL PROTECTED]> 11/03/2

[PHP-DB] die vs exception

2007-04-29 Thread Bruce Cowin
I have written a generic sql database class which contains a method RunQuery which uses mssql_query. To catch errors, should I include the "or die" clause or should I wrap it in a try/exception block? The first will stop the script running but for a generic class, I was thinking it'd be better

Re: [PHP-DB] die vs exception

2007-04-30 Thread Bruce Cowin
w"ing it. Prons and cons for all, just wanted to throw in this option too. Btw, both the DB and MDB2 packages are already generic classes that support mssql as well as other DBMS programs, so if you're not familiar you may want to look up the details at http://pear.php.net. Good luck!

[PHP-DB] PDO and MS Sql Server

2007-07-05 Thread Bruce Cowin
I'm using PHP 5.1. The documentation for PDO doesn't list MS Sql server as one of the drivers that support PDO but there is a php_pdo_mssql.dll which seems to work so I'm using that. I need to get the id of a new record just inserted. I can't use lastInsertId() as I get a message saying it's

Re: [PHP-DB] PDO and MS Sql Server

2007-07-05 Thread Bruce Cowin
how I'll capture that yet. If that doesn't work, I'll just do a "select @@identity". Thanks again. Regards, Bruce >>> Chris <[EMAIL PROTECTED]> 6/07/2007 12:44:34 p.m. >>> Bruce Cowin wrote: > I'm using PHP 5.1. The documentation for

Re: [PHP-DB] Preparing SQL insert statements from CSV files

2007-10-04 Thread Bruce Cowin
And if you're using MS SQL Server, you can use BULK INSERT. Regards, Bruce >>> Chris <[EMAIL PROTECTED]> 5/10/2007 3:30:13 p.m. >>> T K wrote: > Hi, > > I have to parse csv files and put them into database. I was able to > parse the files by fgetcsv() and made an HTML table. But, when it > com

[PHP-DB] PHP 5.2 and MySQL on IIS

2007-11-01 Thread Bruce Cowin
I originally sent this message to the general list, but maybe it's more appropriate here... I have just installed PHP 5.2.4 on Windows 2003 machine running IIS. Everything is fine except when I try to enable the MySQL extension (either php_mysqli.dll or php_mysql.dll), when I do a php_info(), at

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Bruce Cowin
I think what you mean to do is use IN(). And I would suggest table aliases. So it could look like this: SELECT * FROM ministry_directory md INNER JOIN ministry_directory_listing_categories mdlc ON md.entry = mdlc.ministry_directory_entry WHERE md.listing_type = 2 AND mdlc.ministry_directory_