Hello,
I have a functions.php file, which has a function called connectDatabase(). I also run this function among with session_start(); on top of each php file that requires both.
But, in some other files I also have
include(‘functions.php’). So my question is, does including a php file trigger functions that are initially ran by included file?
My next question is mysql related, I get results by:
function getSearchHistory($email)
{
if($email){
$sqlRequest = "SELECT * FROM gvntools_history WHERE email='$email' ORDER BY timestamp";
$result = mysql_query($sqlRequest);
if($result){
$rows = mysql_num_rows($result);
if($rows > 0){
for($i=0; $i<$rows; $i++){
$timestamp = mysql_result($result, $i, 'timestamp');
$searchID = mysql_result($result, $i, 'searchid');
echo "Search $searchID | $timestamp | <a href=\\"search/$searchID.txt\\" target=\\"_blank\\">Open</a><br>";
}
}}}
}
But I get them printed out from oldest to newest, while I would like to from newest to oldest. One way would be to change for statement to:
for($i=$rows; $i>0; $i–) but I am wondering if there is any other way with ORDER command in mysql query.