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; ?> Link to comment https://forums.phpfreaks.com/topic/96449-php-movenext/ 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? Link to comment https://forums.phpfreaks.com/topic/96449-php-movenext/#findComment-493640 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. Link to comment https://forums.phpfreaks.com/topic/96449-php-movenext/#findComment-493647 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. Link to comment https://forums.phpfreaks.com/topic/96449-php-movenext/#findComment-493648 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 Link to comment https://forums.phpfreaks.com/topic/96449-php-movenext/#findComment-493665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.