Apache2Triad Help, Support and Development Forum Index Search Profile Log in to check your private messages Log in Register Memberlist Attachments Statistics Crew/Ranks Archive
 Can't Create an ODBC Connection
Google
Post new topic Reply to topic
Author Message
CornStalks
 
 


Joined: 06 Aug 2005
Posts: 2

PostPosted: Sat Aug 06, 2005 6:37 pm Reply with quoteBack to top

I'm at http://www.w3schools.com/php/php_db_odbc.asp trying to go through a tutorial. I created a database using the following steps:


    Open the Administrative Tools icon in your Control Panel.
    Double-click on the Data Sources (ODBC) icon inside.
    Choose the System DSN tab.
    Click on Add in the System DSN tab.
    Select the Microsoft Access Driver. Click Finish.
    In the next screen, click Select to locate the database.
    Give the database a Data Source Name (DSN).
    Click OK.


The database name and data file are both named testing. Here is the code I'm using:

Code:

<html><body>

<?php
$conn=odbc_connect('testing','','');

if (!$conn)
{
   exit("Connection Failed: " . $conn);
}

$sql="SELECT * FROM customers";
$rs=odbc_exec($conn,$sql);

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

echo "<table><tr>";
echo "<th>Companyname</th>";
echo "<th>Contactname</th></tr>";

while (odbc_fetch_row($rs))
{
   $compname=odbc_result($rs,"CompanyName");
   $conname=odbc_result($rs,"ContactName");
   echo "<tr><td>$compname</td>";
   echo "<td>$conname</td></tr>";
}

odbc_close($conn);
echo "</table>";
?>

</body></html>


When I run it, it says: "Error in SQL". What am I doing wrong?
View user's profileSend private messageMSN Messenger
Vlad Alexa Mancini
lead developer
lead developer


Joined: 07 Jul 2003
Posts: 1539

PostPosted: Sat Aug 06, 2005 7:19 pm Reply with quoteBack to top

http://www.w3schools.com/php/php_db_odbc.asp wrote:
Here is how to create an ODBC connection to a MS Access Database:


why are you asking here , Apache2triad only has 2 DBMS (MySQL and PostgreSQL) MS Access is neither part of apache2triad , opensource , or worth using

if you are asking for php help with your code , id say you might be lacking a password and login
View user's profileSend private message
CornStalks
 
 


Joined: 06 Aug 2005
Posts: 2

PostPosted: Sat Aug 06, 2005 8:39 pm Reply with quoteBack to top

Oh, I see. Forgive me, I'm a newb (as if it isn't already obvious). I'm sorry, and thanks for the heads up.
View user's profileSend private messageMSN Messenger
Display posts from previous:      
Post new topic Reply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme
All times are GMT