Click to See Complete Forum and Search --> : ODBC (IIS and SQL Server and PHP)


n8guy
11-20-2003, 05:16 PM
Not a nice combo, eh (see subject)? I agree, but IT makes those decisions, I just code.

Anyway...

I am having some severe problems getting anything back from this query I am running. I am quite new to using PHP to access DBs, so pardon my lameness. I have read quite a bit and looked at the PHP.net functions and I'm lost. Here's what's going on:

<?php

$sqlString = "SELECT * FROM IamRetarded";

if ($DBconnection = odbc_connect(mydsn, myusername, mypassword, SQL_CUR_USE_ODBC))
{
$query = odbc_exec($DBconnection, "$sqlString");

while ($row = odbc_fetch_row($result))
{
for ($i=0; $i<odbc_num_fields($result); $i++)
{
echo $row[$i] . " \n";
}
}

odbc_close($DBconnection);

?>

So what do I get in return? Um...nada... No errors, nuthin. I've done quite a bit of troubleshooting... help? :confused:

Khalid Ali
11-20-2003, 05:50 PM
Make sure there are some retarded records in the db...:D

if all that is good, then I will have to say that check your DSN see if thats pointing to a proper db