title: Connect to wamp server
body: <p>I keep getting an error message:  </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function execute() on a non-object in C:\wamp\www\Website\index.php on line 46</p>
  </blockquote>
  
  <p>Below is my code. What could be going wrong? I am just using the stock root account for now.</p>
  
  <pre><code>&lt;?php
  
  $dbserver="localhost";
  $username="root";
  $password="";
  $connection=mysql_connect("$dbserver","$username","$password")or die("could not connect to the server");
  
  //execute an SQL statement and return a recordset
  $rs = $connection-&gt;execute("SELECT product_name FROM products");
  $num_columns = $rs-&gt;Fields-&gt;Count();
  
  echo "&lt;table border='1'&gt;"; 
  echo "&lt;tr&gt;&lt;th&gt;Name&lt;/th&gt;&lt;/tr&gt;";
  while (!$rs-&gt;EOF) //looping through the recordset (until End Of File)
  {
       echo "&lt;tr&gt;";
       for ($i=0; $i &lt;  $num_columns; $i++) {
           echo "&lt;td&gt;&lt;a href=\"product.php?id=" . $rs-&gt;Fields('id').value . "\"&gt;" . $rs-&gt;Fields($i)-&gt;value . "&lt;/a&gt;&lt;/td&gt;";
       }
       echo "&lt;/tr&gt;";
       $rs-&gt;MoveNext();
  }
  echo "&lt;/table&gt;";
  
  //close the recordset and the database connection
  $rs-&gt;close();
  $rs = null;
  $conn-&gt;close();
  $conn = null;
  ?&gt; 
  </code></pre>