Connecting Tech Pros Worldwide Help | Site Map

please help for beginner(php + ms access)

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:30 PM
peterlai@rotiprata.net
Guest
 
Posts: n/a
Default please help for beginner(php + ms access)

<html>
<head>
</head>

<body><pre>
<?php

$connection =
odbc_connect("test","root","passwd");

$query = odbc_exec($connection, "SELECT * FROM
People");

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

echo "\n";
}

odbc_close($connection);
?>
</pre>
</body>
</html>
I got an error msg
Notice: Undefined variable: result in C:\Apache2\htdocs\test3.php on
line 14

Warning: odbc_fetch_row(): supplied argument is not a valid ODBC
result resource in C:\Apache2\htdocs\test3.php on line 14

thank in adv


  #2  
Old July 17th, 2005, 01:30 PM
mattvenables
Guest
 
Posts: n/a
Default Re: please help for beginner(php + ms access)

that's because you never defined the variable $result that you are
sending to the odbc_fetch_row function. try changing it to this:

while ($row = odbc_fetch_row($query))

  #3  
Old July 17th, 2005, 01:30 PM
Tony
Guest
 
Posts: n/a
Default Re: please help for beginner(php + ms access)


"mattvenables" <mattvenables@gmail.com> wrote in message
news:1118146126.870262.314520@g14g2000cwa.googlegr oups.com...[color=blue]
> that's because you never defined the variable $result that you are
> sending to the odbc_fetch_row function. try changing it to this:
>
> while ($row = odbc_fetch_row($query))
>[/color]

or:

$result = odbc_exec($connection, "SELECT * FROM
People");

since '$result' is used twice (it's also in the loop at "for ($i=0;
$i<odbc_num_fields($result);$i++)" )



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.