title: Random banner display using php and mysql
body: <p>I'm creating my website <a href="http://xclo.mobi/xclo2" rel="nofollow">located here</a> </p>
  
  <p>I'm trying to add a banner that changes every time a page refreshes. I have set up 2 examples in my database called "link 1" and "link 2". I will want to add more as and when I get them. </p>
  
  <p>What I want to happen is this: </p>
  
  <p><strong>I want to display one of the 2 images on my site and when the user refreshes the page, it will select one of the 2 images and this should continue every time the page refreshes.</strong> </p>
  
  <p>I'm testing this out in a page called banner.php before I move it to my footer.php and make it live. </p>
  
  <p>I currently have this code In my banner.php page:</p>
  
  <pre><code>&lt;?PHP
  include_once('include/connection.php');
  
  // Edit this number to however many links you want displaying
  $num_displayed = 1 ;
  
  // Select random rows from the database
      global $pdo;
        $query = $pdo-&gt;prepare ("SELECT * FROM banners ORDER BY RAND() LIMIT $num_displayed"); 
        $query-&gt;execute();
  
  // For all the rows that you selected
  while ($row = execute($result)) 
  
  {
  // Display them to the screen...
  
  echo "&lt;a href=\"" . $row["link"] . "\"&gt;
  &lt;img src=\"" . $row["image"] . "\" border=0 alt=\"" . $row["text"] . "\"&gt;
  &lt;/a&gt;" ;
  }
  ?&gt;
  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
  </code></pre>
  
  <p>But I am getting this error code:</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined function execute() in banner.php on line 13</p>
  </blockquote>
  
  <p>My connection page is used by other pages so I know it works. </p>
  
  <p>Please can some one help me on what I am doing wrong. </p>
  
  <p><em>Need any more info then please ask and I will add it to this post.</em> </p>
  
  <p>Thank you. </p>
  
  <p>Kev</p>