0

Well first off, i am really sorry if this is a duplicate topic. I did look but couldn't find anything.

Here is my code:

<div id="box">
        <?php
            $query = mysqli_query($connection, "SELECT 'id', 'name', 'url' FROM uploads");
            if(!$query)
                echo("Connection Error: " . mysqli_connect_error());
            else
            {
                while($run = mysqli_fetch_array($query))
                {
                    $videoid = $run['id'];
                    $videoname = $run['name'];
                    $videourl = $run['url'];
                ?>
                <a href='http://Seann.me.uk/Streamy/view.php?video=<?php echo $videourl; ?>'>
                <div id="url">
                    <?php echo $videoname; ?>
                </div>
                <?php
                }
            }
        ?>
    </div>

$videoname just keeps coming back as "name" and $videourl comes back as http://Seann.me.uk/Streamy/view.php?video= I only have 2 videos in my database at the moment but obviously they have different names and id's. Any help is appreciated, thanks for reading.

Seann
  • 11
  • 1
  • 2

1 Answers1

1

remove the quotes in the select, by using them you are selecting the value (string literal) 'name' not the field contents

 $query = mysqli_query($connection, "SELECT id, name, url FROM uploads");
  • Wow i feel stupid, as you can tell im new to php and mysql. Thank you so much it works fine now. :) – Seann Jun 14 '15 at 21:25
  • your welcome please read: http://stackoverflow.com/help/someone-answers –  Jun 14 '15 at 21:26