Jump to content

KevHopwood

Members
  • Posts

    28
  • Joined

  • Last visited

Posts posted by KevHopwood

  1. Hi all..

     

     

    I did use a video tutorial.

     

    I used this one: http://www.youtube.com/watch?v=vM6_OCAoiFg

     

    i watched all 7 and it worked perfectly.

     

    What I then did is added a new table to my mysql called "apps" and I replaced all the column names which where column_??? to app_???. I just assumbed that as I have changed the little details then it must work the same.

     

    so can no one tell me where I am going wrong?

  2. Hi guys.

     

    I am creating a cms for my own and am rather new to php and databases.

     

    what i want is to simply display each item on my mysql database in a list and display each image with the title next to it.

     

    I currentiy have this code on my index page:

    <?php
     
    include_once('include/connection.php');
    include_once('include/article.php');
    
    $app = new article;
    $apps = $app->fetch_all();
    
    ?>
     
    <html>
    
    <head>
    <title>App Donate</title>
    <link rel="stylesheet" href="style.css" />
    </head>
    
    <body>
    
    <ol>
        <?php foreach ($apps as $app) { ?>
    
    
             <li><a href="article.php?id=<?php echo $apps['app_id']; ?>">
              
                 <img src="<?php echo $row_getdetails['app_img']; ?>" alt="Image from DB" />
                 <?php echo $apps['app_title']; ?>
    
              </a>
    
    
        <?php } ?>
    </li></ol>
    
    </div>
    </body>
    
    </html>

    include/article.php


    <?php
    
    class article {
    public function fetch_all(){
        global $pdo;
          $query = $pdo->prepare("SELECT * FROM `apps`");
          $query->execute();
    return $query->fetchAll();
                  }
    
    public function fetch_data($app_id) {
       global $pdo;
    
     $query = $pdo->prepare("SELECT * FROM apps WHERE app_id = ?");
      $query->bindValue(1, $app_id);
       $query->execute();
    
    return $query->fetch();
    
    }
    
    }
    
    ?>

    my index page can be found HERE

     

    as you can see it has seen that there is 2 posts in my databace but it just is not displaying the content.

     

    please can someone help?

     

    THANK YOU.

×
×
  • 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.