One row at many times

andersonbd1

New Member
Ok, I'm hoping someone can help me.

I have ODBC set up with PHP. When I fetch rows from my results list, I get the right number of results, but the output doesn't change when I

$print = odbc_result($result, 1);

I don't know what's going on!!!

holdate PlantAbr Description
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY
2002-03-29 AT GOOD FRIDAY

Does anyone have ANY idea?

Thanks,
Ben
 
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
$dsn = "timeslip";
$Table = "plant-abv";
$user = "root";
$upasswd = "x";
$query = "SELECT * FROM pub.Holiday";
$query .= " pub.Holiday.holdate";
$conn = odbc_connect($dsn, $user, $upasswd);
echo "$query";
echo "<br> conn: $conn";
if ($conn <= 0)
echo "<br>Error in connection<BR>";
else
echo "<br>Connection successful\n";

if($result = odbc_exec($conn, $query))
echo "<p>SQL statement worked\n";
else
echo "<br>SQL statement bad<br>";

// This prints every row the same
odbc_result_all($result);

if($result = odbc_tables($conn))
echo "<p>SQL statement worked\n";
else
echo "<p>SQL statement bad\n";
// This part displays fine
odbc_result_all($result);

// close the connection
odbc_close($conn);

?>

</body>
</html>
 
1. not sure about this query

$query = "SELECT * FROM pub.Holiday";
$query .= " pub.Holiday.holdate";

2. You might try using odbc_prepare followed by odbc_execute instead of odbc_exec. This was definitely a problem with V8 databases and openlink MT drivers (You dont specify your setup).
 
whoops - the query wasn't the problem - I just pasted it wrong. The second line in the query wasn't there. Also, I have tried odbc_prepare and then odbc_execute and still had no success. Still haven't figured it out yet.
 
Back
Top