jkewlo Posted March 16, 2008 Share Posted March 16, 2008 hey all i am trying to get $rs->MoveNext(); to work but i keep getting this error Fatal error: Call to a member function MoveNext() on a non-object in this is my code any help would be great <? $url = $_REQUEST["id"]; $conn = odbc_connect("Rainwater", "", ""); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM Books WHERE Catergory = '". $url ."' ORDER BY Product_id "; $rs = odbc_exec($conn,$sql); if ($rs) while (!$rs->EOF) { echo "<TABLE width=981>"; echo "<TR BGCOLOR=\"#C6FF4B\" width=100%>"; echo "<TH width=123 height=21 valign=top>Book Cover</TH>"; echo "<TH width=123 height=21 valign=top>Product_id</TH>"; echo "<TH width=110 valign=top>Catergory</TH>"; echo "<TH width=222 valign=top>Title</TH>"; echo "<TH width=123 valign=top>Author</TH>"; echo "<TH width=143 valign=top>Price</TH>"; echo "<TH width=118 bgcolor=white> </TH> </TR> <TR>"; $Boo=odbc_result($rs,"Cover"); $Pro=odbc_result($rs,"Product_id"); $Cat=odbc_result($rs,"Catergory"); $Tit=odbc_result($rs,"Title"); $Aut=odbc_result($rs,"Author"); $Pri=odbc_result($rs,"Price"); echo "<TD height=21 valign=top><img src=$boo.jpg></TD>"; echo "<TD height=21 valign=top>$Pro</TD>"; echo" <TD valign=top>$Cat</TD>"; echo" <TD valign=top>$Tit</TD>"; echo" <TD valign=top>$Aut</TD>"; echo" <TD valign=top>$Pri</TD>"; echo" <TD valign=top> <a href=viewmore.php?Product_id=>View More Details</a> </TD> <TD rowspan=2 valign=top> <form method=post action=add_tobasket.php?> How Many: <SELECT NAME=quantity> <option value=1>1 <option value=2>2 <option value=3> 3 <option value=4>4 <option value=5>5 </select | > <input type=submit value='Add to Basket'> </form></TD> <TD> </TD> </TR> <TR> <TD height=3></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> </TR> <TR> <TD height=40></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD> </TD> <TD></TD> </TR> </TABLE>"; $rs->MoveNext(); } $rs = null; $conn = null; ?> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 16, 2008 Share Posted March 16, 2008 what does odbc_exec return? is it an object that you can use to call it's functions? Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 16, 2008 Author Share Posted March 16, 2008 IDK this is the first time i have ever messed with php/ms access im normally php/mysql. Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 16, 2008 Author Share Posted March 16, 2008 Source from PHP.net Description resource odbc_exec ( resource $connection_id , string $query_string [, int $flags ] ) Returns FALSE on error. Returns an ODBC result identifier if the SQL command was executed successfully. odbc_exec() will send an SQL statement to the database server specified by connection_id . This parameter must be a valid identifier returned by odbc_connect() or odbc_pconnect(). See also: odbc_prepare() and odbc_execute() for multiple execution of SQL statements. Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 16, 2008 Author Share Posted March 16, 2008 any other suggestions to get more than 1 record set to display? im wanting everything with the word General_Art etc... to be displayed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.