0

I've got a mysql query that should return a single cell

SELECT `download` FROM `images` WHERE `owner_un`='$owner' AND `url`='$url'

How would I echo the result of this?
Thanks for any help

4
Contributors
4
Replies
16
Views
4 Years
Discussion Span
Last Post by minitauros
0

In PHP (using mysql), fetching one result:

<?php
$q = "SELECT `download` FROM `images` WHERE `owner_un`='$owner' AND `url`='$url' LIMIT 1";
$rq = mysql_query($q);
$fetch = mysql_fetch_assoc($rq);

echo '<p>Result: ' . $fetch['download'] . '</p>';

Fetching all results:

<?php
$q = "SELECT `download` FROM `images` WHERE `owner_un`='$owner' AND `url`='$url' LIMIT 1";
$rq = mysql_query($q);

while($fetch = mysql_fetch_assoc($rq))
{
    echo '<p>Result: ' . $fetch['download'] . '</p>';
}

Edited by minitauros

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.