#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    1
    Rep Power
    0
    <html>
    <body>
    <?php
    $connection = odbc_connect("test","","") ;
    $sql = "SELECT * FROM CustBasic WHERE CustCode='salman54600'";
    $sql_statement = odbc_prepare($connection,$sql);
    $sql_result = odbc_execute($sql_statement);
    odbc_result_all($sql_result,"border=1");//*
    odbc_free_result($sql_result);//*
    odbc_close($connection);
    ?>
    </body>
    </html>
    //* marked Lines give this Warning: Supplied argument is not a valid ODBC result resource
    //test is a DSN

    ------------------
    Maan
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    i think your DSN name has not created.that is why it is giving you an error.code is looking ok...

    but change the following line...
    odbc_result_all($sql_result,"border=1");

    and remove that the optional format argument..
    so it should be:
    odbc_result_all($sql_result);

    also try the following smaple script:

    <?php
    $con= odbc_connect('SYSTEM_DSN','USER','PASSWORD');
    //Make the database connection..

    $sql = "SELECT * FROM CustBasic WHERE CustCode='salman54600'";

    $row= odbc_exec( $con,$sql);
    //execute the query..

    $first_Coulmn= odbc_result( $row, 1 ); // get the first field from the DB.

    echo $first_Coulmn;

    odbc_close($con);
    ?>


    Make sure that you are creating a System Datasource name and pointing your table towards that.


    Good Luck!!!




    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. Problem web server access
    By caohocle in forum Networking Help
    Replies: 1
    Last Post: February 19th, 2004, 12:06 PM
  2. Custom error message for MySQL connection
    By dbr1066 in forum PHP Development
    Replies: 6
    Last Post: February 12th, 2004, 11:25 AM
  3. working with ODBC
    By jp1234 in forum Oracle Development
    Replies: 0
    Last Post: February 1st, 2004, 02:26 PM
  4. MS Access - Table access problem
    By Wzd in forum ASP Programming
    Replies: 2
    Last Post: January 25th, 2004, 04:39 PM
  5. MS Access - Table access problem
    By Wzd in forum Database Management
    Replies: 1
    Last Post: January 25th, 2004, 12:31 PM

IMN logo majestic logo threadwatch logo seochat tools logo