| | |
odbc-connect error--urgent
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 26
Reputation:
Solved Threads: 0
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\xampp\htdocs\xampp\display.php on line 5
Connection Failed:
php is working fine, ran other simple php scripts...
but this is the error when i connect to a ms access db
the dsn exists and i have selected a db which has the table clients_online and other fields such as ip and mac exist
Connection Failed:
php is working fine, ran other simple php scripts...
but this is the error when i connect to a ms access db
php Syntax (Toggle Plain Text)
<html> <body> <?php $conn=odbc_connect("DB",'',''); 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>IP</th>"; echo "<th>MAC</th></tr>"; while (odbc_fetch_row($rs)) { $name=odbc_result($rs,"ip"); $macname=odbc_result($rs,"mac"); echo "<tr><td>$name</td>"; echo "<td>$macname</td></tr>"; } odbc_close($conn); echo "</table>"; ?> </body> </html>
the dsn exists and i have selected a db which has the table clients_online and other fields such as ip and mac exist
Last edited by peter_budo; Apr 26th, 2008 at 8:20 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Jan 2008
Posts: 26
Reputation:
Solved Threads: 0
oh thanks, i changed it to a system dsn now...
but i get this error msg
Warning: odbc_connect() [function.odbc-connect]: SQL error: Failed to fetch error message, SQL state HY000 in SQLConnect in C:\xampp\htdocs\xampp\display.php on line 5
Connection Failed:
program being this
but i get this error msg
Warning: odbc_connect() [function.odbc-connect]: SQL error: Failed to fetch error message, SQL state HY000 in SQLConnect in C:\xampp\htdocs\xampp\display.php on line 5
Connection Failed:
program being this
php Syntax (Toggle Plain Text)
<html> <body> <?php $conn=odbc_connect('data','',''); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM clients_online"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<table><tr>"; echo "<th>ip</th>"; echo "<th>mac</th></tr>"; while (odbc_fetch_row($rs)) { $compname=odbc_result($rs,"ip"); $conname=odbc_result($rs,"mac"); echo "<tr><td>$compname</td>"; echo "<td>$conname</td></tr>"; } odbc_close($conn); echo "</table>"; ?> </body> </html>
Last edited by peter_budo; Apr 26th, 2008 at 8:20 am. Reason: Keep It Organized - please use [code] tags
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: uploading iamges to server
- Next Thread: Automate PHP-MYSQL-PGSQL
Views: 2678 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






