tags:

views:

12

answers:

0

Hello

I am wondering how you would display 2 different kinds of data with one query if its possible in the most efficient way. I want to display a list of featured records and then I want to display a list of none featured records in order.

Here is how i currently have it,

<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("Deaths");

$query = "SELECT * FROM killers";
$run = mysql_query($query) or die(mysql_error());
$found = mysql_num_rows($run);

if($found == 0) {
        echo 'No Results found';
} else {
    while($row = mysql_fetch_array($run)) {
        $featured = $row['featured'];
        if($featured == 1) {
                echo 'Displaying Featured info';
        }
    }

    $run = mysql_query($query) or die(mysql_error());

    while($row = mysql_fetch_array($run)) {
        $featured = $row['featured'];
        if($featured == 0) {
                echo 'Displaying None Featured info info';
        }
    }

}
?>

If there is a better way to do this then can someone please let me know, also i wanted to display random featured records, so basically it displays 1 featured random site for the featured.

Thanks