Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Drop Down Executes Query On Post? Reply To: Drop Down Executes Query On Post?

#170644
MBM
Participant

Updated code (only ouputs on record) :

$result = mysql_connect($Host, $User, $Password);
if(isset($_POST['Submit'])){
if($_POST['value'] == '1') { 
    // query to get all 1 star ratings
    $query = mysql_query("SELECT * FROM films WHERE genre='action' AND rating='1'"); 
} 
elseif($_POST['value'] == '2') { 
    // query to get all 2 star ratings
    $query = mysql_query("SELECT * FROM films WHERE genre='action' AND rating='2'"); 
}   
elseif($_POST['value'] == '3') { 
    // query to get all 3 star ratings
    $query = mysql_query("SELECT * FROM films WHERE genre='action' AND rating='3'"); 
    }   
elseif($_POST['value'] == '4') { 
    // query to get all 4 star ratings
    $query = mysql_query("SELECT * FROM films WHERE genre='action' AND rating='4'"); 
    }   
elseif($_POST['value'] == '5') { 
    // query to get all 5 star ratings
    $query = mysql_query("SELECT * FROM films WHERE genre='action' AND rating='5'"); 
} 

WHILE($row = mysql_fetch_array($query)){
$title = $row['title'];
$studio = $row['studio'];
$language = $row['language'];
$certification = $row['certification'];

The rest of the code is as previous. I had to remove the [] above as it outputs Array – literally it displayed array.