p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > PHP/MySQL > Beginning PHP
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 9th, 2004, 03:59 AM
Authorized User
Points: 251, Level: 5
Points: 251, Level: 5 Points: 251, Level: 5 Points: 251, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Belfast, , United Kingdom.
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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 05: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 10:43 AM
DNS kilika Classic ASP Professional 5 August 4th, 2004 01:53 PM



All times are GMT -4. The time now is 03:18 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc