Re: mixing and matching mysql mssql whileloop within an if case

2012-05-04 Thread Rik Wasmus
I could suggest a number of ways around the if/else construct, such as creating a subclass for the various servers with a uniform interface and hiding the differences inside the class. This, but I'd prefer using one of the already available abstractions for PHP: - PDO: http://www.php.net/PDO

mixing and matching mysql mssql whileloop within an if case

2012-05-03 Thread Haluk Karamete
Please take a look at the following code and tell me if there is a way around it. if ($current_server_is_mysql): while ($row = mysql_fetch_assoc($RS)) { else: while( $row = sqlsrv_fetch_array( $RS, SQLSRV_FETCH_ASSOC)){ endif: Depending on the server I'm working with, I'd like to compile

RE: mixing and matching mysql mssql whileloop within an if case

2012-05-03 Thread Rick James
-Original Message- From: Haluk Karamete [mailto:halukkaram...@gmail.com] Sent: Thursday, May 03, 2012 10:21 AM To: MySQL Subject: mixing and matching mysql mssql whileloop within an if case Please take a look at the following code and tell me if there is a way around

Re: mixing and matching mysql mssql whileloop within an if case

2012-05-03 Thread Brown, Charles
Sent from my iPhone On May 3, 2012, at 1:02 PM, Haluk Karamete halukkaram...@gmail.com wrote: Please take a look at the following code and tell me if there is a way around it. if ($current_server_is_mysql): while ($row = mysql_fetch_assoc($RS)) { else: while( $row =

Re: mixing and matching mysql mssql whileloop within an if case

2012-05-03 Thread Baron Schwartz
Haluk, I could suggest a number of ways around the if/else construct, such as creating a subclass for the various servers with a uniform interface and hiding the differences inside the class. The actual error that you showed is much simpler, however: you are mixing curly-brace style with what I

Re: mixing and matching mysql mssql whileloop within an if case

2012-05-03 Thread Alex Schaft
I suppose an easier way is to have a getrow function, Something like while ($row = getrow($RS) { . . . } function getrow($RS) { if ($current_server_is_mysql) { return mysql_fetch_assoc($RS); } else