php break statement for different title for every page -
i'm not familiar php. apologies if posted already. i'm using following code set title of every page. config.php have ->
$pag = $_server['php_self']; switch ($pag){ case '/artist.php': $title= $db->query('select name artist'); $description = $db->query('select des artist'); break; case '/album.php': $title= $db-query('select name album'); $description = $db->query('select des album'); break; }
artist.php have ->
print_r($title); print_r($description);
everything working fine. want know when land on artist.php
4 query executed or case /artist.php
's 2 queries?
answer twinfriends correct. because of break
, program execute 1 branch of switch
.
you can find yourself. 1 way debugger, can go step-by-step. way test print (echo()
or var_dump()
) in each branch of switch
. see, gets printed, , not.
Comments
Post a Comment