How do i write this code outside of a function, i have a tutorial but it shows me how to convert script into a function but this example below never did, it was just wrote straight into a function.
function get_subject_by_id($subject_id) {
global $connection;
$query = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE id=" . $subject_id ." ";
$query .= "LIMIT 1";
$result_set = mysql_query($query);
// REMEMBER:
// if no rows are returned, fetch_array will return false
if ($subject1 = mysql_fetch_array($result_set)) {
return $subject1;
} else {
return NULL;
}
}