Log in

View Full Version : MySQL php WHERE?



queerfm
02-01-2009, 10:28 PM
Hi i am trying to do a WHERE function but cant seem to get it working this time.
I am trying to get only News items from the row named type

[code]
<?php

$mainplayer = "SELECT * FROM jos_video WHERE type = news LIMIT 1";
$mainplayerresult = mysql_query($mainplayer);
while($row = mysql_fetch_assoc($mainplayerresult))
{
echo "http://www.queerhuntradio.com/images/video/{$row['url']}";
}
?>

Schmoopy
02-01-2009, 10:32 PM
Try using:


WHERE type = 'news' LIMIT 1

Sometimes solves the problem.

Nile
02-01-2009, 10:37 PM
Better to tick your table names and fields to:


$mainplayer = "SELECT * FROM `jos_video` WHERE `type` = 'news' LIMIT 1";


And return errors too:


$mainplayerresult = mysql_query($mainplayer) or die("Mysql Error: ".mysql_error());