i have function file called models.php, which stores all my database functions, for example
// get the updates for the $user_id profile
function getProfileUpdates($user_id) {
$query="SELECT m . * , u.picture, u.username
FROM notes m, user u
WHERE m.user_id = u.user_id
AND u.user_id ='$user_id'
ORDER BY m.dt DESC
LIMIT 10";
$result = mysql_query($query);
return $result;
}
function getTopicId($topic){
$query="SELECT id
FROM topic
WHERE topic ='$topic'
";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
return $row['id'];
}
is it okay to have all my mysql queries in one file, so then i can use any of them whenever i want during developing my web app, is this good practice, or is thier a better alternative.
p.s. my main concern is functioniality and performance, code readability is not an issue right now!