I assume you want only one result from your table. Secondly, you should save the url you want to redirect to in your result row.
PHP Code:
$query = "SELECT field, url FROM table LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
if($row['field'] == 0){
}else{
header("location:$row['url']");
}
"field" is your 1 or 0 query-array element