Jump to content

PHP->MoveNExt();


jkewlo

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.