Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2004, 02:59 AM
Authorized User
 
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default DNS-less ODBC php

Hi, can anyone help me?

I am receiving this error:

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource
inwebserver\webroot\test\thought.php on line 14. Error in SQL

As far as I understand, the query is correct and I have . Below is the code which I am using:

<?php
    $conn = new COM('ADODB.Connection');
    $db = 'webserver\morrislgn\database\firstchurch.mdb';
    $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

    if (!$conn)
    {
        exit("Connection Failed: " . $conn);
    }
    $date = date("jm");
    $sql="SELECT * FROM thoughts where date = $date";
    $rs=odbc_exec($conn,$sql);

    if (!$rs)
    {
        exit( "Error in SQL" );
    }

    echo ( "<table>" );

    while (odbc_fetch_row($rs))
        {
        $date = odbc_result ( $rs, "Date" );
        $title = odbc_result ( $rs, "Title" );
        $ref = odbc_result ( $rs, "Reference" );
        $thought = odbc_result( $rs, "Thought" );
        $author = odbc_result( $rs, "Author" );

and the code goes on to write the info to the page through a series of echo commands

Any ideas, workarounds or suggestions for better ways to code this?

cheers,

Morris







Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing from DNS to DNS less connection dudeshouse Classic ASP Databases 4 February 7th, 2007 12:02 PM
ODBC - insert on a linked field - [microsoft][ODBC chimp MySQL 0 April 7th, 2005 04:44 AM
secondary DNS vs. second primary DNS gangu1971 Linux 1 March 1st, 2005 10:40 AM
DNS-less ODBC php Morrislgn PHP Databases 0 September 9th, 2004 09:43 AM
DNS kilika Classic ASP Professional 5 August 4th, 2004 12:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.