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
opinion
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.
/opinion
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 =
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
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