From: Rick James Date: May 3 2012 5:55pm Subject: RE: mixing and matching mysql & mssql whileloop within an if case List-Archive: http://lists.mysql.com/mysql/227311 Message-Id: <2E7DD7ADE53B044C8C8BCD9C5829E1EB1485A7E169@SP2-EX07VS01.ds.corp.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cross-platform coding is folly. There are too many differences (LIMIT, ROW= NUM, SEQUENCE vs AUTO_INCREMENT, ...) that you either stumble over, or end = up special casing, or you simply code to the "least common denominator", th= ereby getting poor performance on all platforms. > -----Original Message----- > From: Haluk Karamete [mailto:halukkaramete@stripped] > Sent: Thursday, May 03, 2012 10:21 AM > To: MySQL > Subject: mixing and matching mysql & mssql whileloop within an if case >=20 > Please take a look at the following code and tell me if there is a way > around it. >=20 > if ($current_server_is_mysql): > while ($row =3D mysql_fetch_assoc($RS)) { > else: > while( $row =3D sqlsrv_fetch_array( $RS, SQLSRV_FETCH_ASSOC)){ > endif: > Depending on the server I'm working with, I'd like to compile my > records into the $RS recordset the proper/native way. If I can get pass > this part, the rest should be all right cause both mysql and mssql $row > can be tapped into the same way. For example, $row['fieldname'] will > give me the field value whether the row was a mysql or mssql resource. > So it all boils down to the above snippet failing. >=20 > The error I get points to the else: part in the above snippet. >=20 > Parse error: syntax error, unexpected T_ELSE in > D:\Hosting\5291100\html\blueprint\pages\populate_migration_table.php > on line 415 > I can understand why I am getting this error. >=20 > But, I'm hoping you guys can offer a work-around it without me > resorting to duplicate the entire while loop she-bang. >=20 > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql