> 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
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
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
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
-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
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 m