Page 1 of 1

PDO trouble

Posted: Mon Nov 19, 2007 10:38 am
by dapperdanman1400
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi, I'm trying to start working with the PDO object class for database use.  I'm using MSSQL as my database.

The problem is when I use the SQL wildcard (*), it returns zero rows as results.  However, when I specify a specific column, it outputs results just fine.  What could I be missing?  Code below:

Code: Select all

<?php

try {
  $dbh = new PDO('mssql:host=localhost;dbname=test_db', 'db_name', 'notarealpassword');
  foreach ($dbh->query('SELECT * FROM test_table') as $row) {
      print_r($row);
   }
   $dbh = null;
  
}
catch (PDOException $e) {
   die('<span style="font-style: bold;">Error:</span> '.$e->getMessage());
}

?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

can you try adodb

Posted: Mon Nov 19, 2007 8:18 pm
by yacahuma
can you try adodb. The syntax is almost identical. I am curious if you get the same results.
http://adodb.sourceforge.net/