In general, there are a couple of functions on the page (displaying articles, sections, displaying user panels). Where and how is it better to do the processing of the received data: a common function at the beginning of the page and use global variables or in the same output functions? What to display in _get and / or what to write to the database and / or authorization.
There is such a golden rule for building any web application.
- Code first (php,python) or whatever
- Page markup.
If you have a news.py page?id=7&cat=2&ref=http://google.com/
It’s easier to start with a ternary operator that will do a lot of things in one line:
$get = isset($_GET['id']) ? $_GET['id'] : exit(" "); $q = mysql_query("select * from `news` where `id` = '". $get ."'") or die(mysql_error()); while($row = mysql_fetch_assoc($q)) $rows = $row;
the most common example of the output of something