Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7885089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:58:16+00:00 2026-06-03T04:58:16+00:00

Please take a look at the following code and tell me if there is

  • 0

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

The error I get points to the else: part in the above snippet.

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.

But, I’m hoping you guys can offer a work-around it without me resorting to duplicate the entire while loop she-bang.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:58:17+00:00Added an answer on June 3, 2026 at 4:58 am

    You’ve got some syntax mismatches, and putting your code in a function like this worked for me:

    if ($current_server_is_mysql):
        while ($row = mysql_fetch_assoc($RS)) {
            ProcessThisRow($row);
        }
    else:
        while( $row = sqlsrv_fetch_array( $RS, SQLSRV_FETCH_ASSOC)){
            ProcessThisRow($row);
        }
    endif;
    
    function ProcessThisRow ($row) {
        /*Put your code in this function */
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please take a look at the following code and tell me why skillPercentange is
Please take a look at following code: #include <stdio.h> #include <iostream> using namespace std;
Please take a look at the following code: Public Sub Method(Of TEntity As EntityObject)(ByVal
Would someone please take a look at the following code fragments (all from one
Please take a look at following code: public class SomeEntity { public int Id
Please take a look at the following code: Sort[{1, y, x}, Greater] Max[{1, x,
Please take a look at the following autocomplete code. $(document).ready(function(){ $(#the_input).autocomplete(/autocomplete.php, { //some options
Please take a look at the following code: public static void main(String[] args) {
I have a string with url.Please take a look at the following code.I am
Please take a look at the following code... $(#page_info_select_box).live(keypress,function(){ var sele = domain; var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.