Jump to content

  • Log In with Google      Sign In   
  • Create Account


future_man

Member Since 09 Aug 2013
Offline Last Active Sep 01 2013 05:33 PM

Posts I've Made

In Topic: Subtract timestamp time from current time

01 September 2013 - 03:49 PM

OK I solved my problem like this:

$current_time = date_create(date("Y-m-d H:i:s"));
$last_time = date_create(date("Y-m-d H:i:s", strtotime(get_last_update_time($user_name))));
$result = date_diff($current_time, $last_time);

echo $result->format('%Y-%m-%d %H:%i:%s');

but it echoes my result like so: "00-0-0 03:40:56", with all the days etc.. How do I format this so that it only show hours, lets say like so: "232156". With all the days, months years, formatted to hours?


In Topic: Subtract timestamp time from current time

01 September 2013 - 02:41 PM

I looked into this diff function already but how do I use it?


In Topic: Display database rows in html by id

26 August 2013 - 05:22 AM

Say that your table has 3 columns and you want to list all entries separated by a ',' and break a line after each entry:

$query = "SELECT * FROM sport";
$result = mysql_query($query);
$foundResults = mysql_fetch_array($result);
if(mysql_error())
{
    echo 'Error in query [' . mysql_error() . ']<br>';
}
else if ($foundResults == NULL)
{
    echo 'No results.<br>';
}
else
{
    do
    {
       echo $foundResults[0] . ', ' . $foundResults[1] . ', ' . $foundResults[2] . '<br>';
    } 
    while(($foundResults = mysql_fetch_array($result, MYSQL_NUM)) != NULL);
}

Hope that helps.

 

Thank you, I did a similar approach! Turns out you really need to just put a break tag at the end and echo it :D how simple is that


In Topic: Website server directory access

13 August 2013 - 03:18 PM

 

You can put files there but nobody can access them except for those with file-access to the hosting provider.

 

Except if you have index.php with all of the includes in your root, am I right?


In Topic: Website server directory access

13 August 2013 - 03:06 PM

How do you make a root directory though? Isn't the place you get with the server always the "root"? Or can you access diferent folders on a bought server and place files in the more safer place for example?


PARTNERS