Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5

Thread: mssql_error()

  1. #1
    Senior Member jbagley's Avatar
    Join Date
    Sep 2004
    Location
    Cape Town
    Posts
    845
    Member #
    7422
    Is there an equivalant error function for MSsql?

    In Mysql, to get the query error, you use mysql_error(), but it seems that mssql_error() doesnt exist.

    How would one retrieve the query error in MSsql? :classic:

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    A google search showed that you have to include the database connection stirng in the brackets

    PHP Code:
    mssql_error($conn); 
    http://codewalkers.com/archives/phpcoding/9293.html - about halfway down, a post by lmayer on August 3 2004, 11:11

  4. #3
    Senior Member jbagley's Avatar
    Join Date
    Sep 2004
    Location
    Cape Town
    Posts
    845
    Member #
    7422
    thanks bfsog, but I dont see it.... his code is as follows...
    PHP Code:
    <?php

    //first get a mssql connection
    $link mssql_connect('HQMSDB05');

    if (!
    $link) {
    die(
    'Not connected : ' mssql_error());
    }
    // set the current db
    $db_selected mssql_select_db('Yardcheck'$link);
    if (!
    $db_selected) {
    die (
    'Cant use db : ' mssql_error());
    }
    $fcontents file ('C:/Upload/Bratt2.txt');
    $fcontents str_replace("\r","<br>\n",$fcontents);

    for(
    $i=0$i<sizeof($fcontents); $i++) {
    $line trim($fcontents[$i]);
    $arr explode(","$line);
    echo 
    $line;

    $sql "Insert Into tblM5Upload (Location,TrailerID,TrailerType,
    Classification,Contents,Comments,UpLoadDate,UpLoadTime,Source)
    values ('"
    .
    implode("','"$arr) ."')";
    mssql_query($sql);
    echo 
    $sql ."<br>\n";

    }

    ?>
    they use mssql_error(), but when I try and use it, I get an error that mssql_error() is not valid.
    Code:
    Fatal error: Call to undefined function mssql_error()

  5. #4
    Senior Member mossoi's Avatar
    Join Date
    Apr 2003
    Location
    Englandshire, United Kingdomsville y'all!
    Posts
    1,111
    Member #
    1206
    Liked
    1 times
    It doesn't look as though mssql_error() is a valid function in php (http://uk2.php.net/manual-lookup.php...error&lang=en).

    You could try using mssql_get_last_message instead (http://www.php.net/manual/en/functio...t-message.php).

  6. #5
    Senior Member jbagley's Avatar
    Join Date
    Sep 2004
    Location
    Cape Town
    Posts
    845
    Member #
    7422
    Thanks mossoi! Works brilliantly....


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

mssql error

,

mssql error php

,
php mssql error
Click on a term to search for related topics.
All times are GMT -6. The time now is 11:30 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com