Wrox Programmer Forums
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases 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, 09:43 AM
Authorized User
 
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default DNS-less ODBC php

hi there,

Firstly let me say sorry for posting this in two places - this morning when I posted this in the beginning PHP forum, I wasnt paying attention to what I was doing and put it there instead of in this forum - ! Sorry.

Here is a description of the problem i am having:

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.

When I wrote this to work on my local machine, it worked fine, but then I had to change t a couple of lines at the top about the connection to make it work on my web server. However, since making the changes, it refuses to work and I dont understand why?

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 Beginning PHP 0 September 9th, 2004 02:59 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.