mysql to sql server 2005

Posted on 2010-01-04
Last Modified: 2012-05-08
what is this in sql server 2005

while ($row = mysql_fetch_array($result)){  
Question by:rgb192
    LVL 30

    Accepted Solution

    >>while ($row = mysql_fetch_array($result)){
    this is not mysql, this is php working with mysql
    If you want to connect to mssql from php, so you can use mssql functions in php:
    this is specially form mssql_fetch_array instead of mysql_fetch_array:

    LVL 81

    Assisted Solution

    This is a loop to get all result from a previous query. All results is put in the variable $result.

    At each loop you put a row from $result in the $row variable.

    In the loop you read field like this : $row['field_name'] or $row[0] for the first field in a row.

    LVL 107

    Assisted Solution

    by:Ray Paseur
    Instead of this:
    while ($row = mysql_fetch_array($result)){  

    You probably want this:
    while ($row = mssql_fetch_array($result)){  

    It looks to me like there is a one-to-one correlation between the MySQL and this MSSQL function.  THe man pages aer very similar for these.

    "mssql_fetch_array() is an extended version of mssql_fetch_row(). In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys. "

    Author Closing Comment

    LVL 81

    Expert Comment

    Big big up!

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to count occurrences of each item in an array.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now