title: Displaying images and text from database
body: <p>I'm attempting to retrieve images from my database and text to put it on the website. This is my code below:</p>
  
  <pre><code>&lt;?php 
      mysql_connect("localhost", "root", "");
      mysql_select_db("gamelogin");
  
      $sql = mysql_query("SELECT * FROM prezentacja ORDER BY id ASC");
      $img = mysql_query("SELECT * FROM img");
  
      $id = 'id';
      $text = 'text';
      $rows = mysql_fetch_assoc($sql);
      $images = mysql_fetch_assoc($img);
  ?&gt;
  
  &lt;html&gt;
     &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;meta name="viewport" content="width=device-width,initial-scale=1.0" /&gt;
        &lt;title&gt;Game Project&lt;/title&gt;
        &lt;link rel="stylesheet" href="css/base.css" /&gt;
        &lt;link rel="stylesheet" type="text/css" href="css/presentation.css"&gt;
        &lt;script src="js/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
        &lt;script src="js/jquery.cslide.js" type="text/javascript"&gt;&lt;/script&gt;
        &lt;script&gt;
           $(document).ready(function(){
               $("#cslide-slides").cslide();
           });
        &lt;/script&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;div id="main"&gt;
           &lt;div class="container"&gt;
              &lt;section id="cslide-slides" class="cslide-slides-master clearfix"&gt;
                 &lt;div class="cslide-prev-next clearfix"&gt;
                    &lt;span class="cslide-list"&gt;&lt;a href="index_front.php"&gt;Lista gier&lt;/a&gt;&lt;/span&gt;
                    &lt;span class="cslide-prev"&gt;Poprzedni&lt;/span&gt;
                    &lt;span class="cslide-skip"&gt;&lt;a href="main.html"&gt;Pomiń&lt;/a&gt;&lt;/span&gt;
                    &lt;span class="cslide-next"&gt;Następny&lt;/span&gt;
                 &lt;/div&gt;
                 &lt;div class="cslide-slides-container clearfix"&gt;
                    &lt;div class="cslide-slide"&gt;
                       &lt;p&gt;
                          &lt;?php if($rows['id'] == 1) echo $rows['text']; ?&gt;
                       &lt;/p&gt;
                       &lt;?php if($images['id'] == 1) echo "&lt;div class=\"slajd_1\"&gt;"; ?&gt; &lt;img src="&lt;?php echo $images["img"]; ?&gt;"&gt; &lt;?php echo "&lt;/div&gt;"; ?&gt;
                    &lt;/div&gt;
                    &lt;div class="cslide-slide"&gt;
                       &lt;p&gt;
                          &lt;?php if($rows['id'] == 1) echo $rows['text']; ?&gt;
                       &lt;/p&gt;
                       &lt;?php if($images['id'] == 1) echo "&lt;div class=\"slajd_2\"&gt;"; ?&gt; &lt;img src="&lt;?php echo $images["img"]; ?&gt;"&gt; &lt;?php echo "&lt;/div&gt;"; ?&gt;
                    &lt;/div&gt;
                    &lt;div class="cslide-slide"&gt;
                       &lt;h2&gt;This is slide 3&lt;/h2&gt;
                       &lt;p&gt;&lt;/p&gt;
                    &lt;/div&gt;
                    &lt;div class="cslide-slide"&gt;
                       &lt;h2&gt;This is slide 4&lt;/h2&gt;
                       &lt;p&gt;&lt;/p&gt;
                    &lt;/div&gt;
                    &lt;div class="cslide-slide"&gt;
                       &lt;h2&gt;This is slide 5&lt;/h2&gt;
                       &lt;p&gt;&lt;/p&gt;
                    &lt;/div&gt;
                 &lt;/div&gt;
              &lt;/section&gt;
              &lt;!-- /sliding content section --&gt;
           &lt;/div&gt;
        &lt;/div&gt;
        &lt;!-- #main --&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm trying to create some sort of presentation in html using PHP to retrieve text for each slide and images from MySql.</p>
  
  <p>This part of code works perfect as I want it to work. I'm getting image and text if id = 1. </p>
  
  <p>But when I'm trying to get image and text of id = 2 it breaks all the website and shows image and text that's id = 1.</p>
  
  <pre><code>&lt;div class="cslide-slide"&gt;
     &lt;p&gt;
        &lt;?php if($rows['id'] == 2) echo $rows['text']; ?&gt;
     &lt;/p&gt;
     &lt;?php if($images['id'] == 2) echo "&lt;div class=\"slajd_2\"&gt;"; ?&gt;
     &lt;img src="&lt;?php echo $images["img"]; ?&gt;"&gt; &lt;?php echo "&lt;/div&gt;"; ?&gt;          
  &lt;/div&gt;
  </code></pre>
  
  <p>Can you please take a look at this and help my to figure it out what it wrong ? Am I doing something wrong with id's ??</p>