is it okay if i put all my db queries in one file?

valentinkakyr

New Member
i have function file called models.php, which stores all my database functions, for example\[code\]// get the updates for the $user_id profilefunction 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']; }\[/code\]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!
 
Back
Top