my code
$query = "SELECT `url` FROM `$drop` WHERE `vidname`= '$tier_two'";
$dave= mysql_query($query) or die(mysql_error());
echo "<p>";
print $query;
im trying to the url feild to echo but im coming up with blanks
my code
$query = "SELECT `url` FROM `$drop` WHERE `vidname`= '$tier_two'";
$dave= mysql_query($query) or die(mysql_error());
echo "<p>";
print $query;
im trying to the url feild to echo but im coming up with blanks
you can do something like:
$result = mysqli_query($query);
$row = mysqli_fetch_array($result);
extract($row);
echo $url;
note: printing $query
is printing your sql command.., for printing your query result, you can use my suggestion or @Companjo 's suggestion (ah, his post was deleted).. and (as @Phil's comment) the reason to use mysqli_*
is because mysql_*
is deprecated..
reference:
http://php.net/manual/en/mysqli-result.fetch-array.php
you might want to see the connection creation using mysqli
here (if you decide to use mysqli_*
):
http://php.net/manual/en/mysqli.quickstart.connections.php
addition: mysql_
and mysqli_
don't differ much.. you'll realize it as you trying it..
You can try this:
$query = mysql_query("SELECT url FROM '$drop' WHERE vidname= '$tier_two'");
while($row = mysql_fetch_array($query)){
$url = $row["url"];
echo $url;
}