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/PD

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);   } els

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 li

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" 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 = sqlsrv_fetch_array( $RS, SQL

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

2012-05-03 Thread Rick James
Cross-platform coding is folly. There are too many differences (LIMIT, ROWNUM, SEQUENCE vs AUTO_INCREMENT, ...) that you either stumble over, or end up special casing, or you simply code to the "least common denominator", thereby getting poor performance on all platforms. > -Original Mes