Hello... I'm going through a bit of a complete overhaul of my website at the moment trying to tidy up all the code, and making it more streamlined.
One of my halts at the moment is with the way I process mysql queries... currently, I use the following almost everywhere:
$flag=mysql_fetch_array(mysql_query("Select * from flag where id_flag=".$user['location']));
I know this is a bad idea to use mysql_fetch_array before mysql_query, but I was wondering the following...
1) I am wanting to show in the footer of my page how many DB queries there were per page. I've seen some examples where instead of using mysql_query, I can use a custom function like "mysql_go" which would do the query, and bump up the queries to display. How would I go about doing this? I assume in my footer it would be as simple as an:
echo "DB Queries: ".$dbcount."";
2) In this my "mysql_go" function too, instead of having a die function if the mysql query fails, could it be integrated into the function so I don't have to put it everywhere?
3) When I use this new function, would it be acceptable to "mysql_fetch_array(mysql_go(x));" or would you suggest doing it another way?
Thanks for any assistance 🙂