Jump to content

Matic

Members
  • Posts

    42
  • Joined

  • Last visited

Matic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh sorry looks like you get the correct result! Thanks for help!
  2. great, I get the part where you convert to strtotime format which is the number of seconds since January 1 1970 00:00:00 UTC etc... Then you divide by 3600 to get hours... Problem is I don't know hot to convert this to my subtracted result back... As it is now, it only shows the hours since January 1 1970 00:00:00...
  3. 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?
  4. Thing is when I convert both formats with strtotime(); and then substract those values the result is off
  5. I want to subtract database timestamp from current server time. The formatted time that is returned to me from my database is "2013-09-01 22:05:39" and I use function date("Y-m-d H:i:s"); so that my server time I get in php is in the same format. How can I get a result in hours? Example: 2013-09-01 22:05:39 minus 2013-09-02 22:05:39 equals 24 hours ???
  6. Thank you so much!
  7. yes this! Now how do I do this properly with foreach statement? This is what I am asking this whole time, though other answers in this thread helped me greatly also
  8. Thanks for all the help but my session variable still shows only the last element of my row. When it is echoes directly it is okay but when it is stored in session it only displays the last element of array... I make my session variable store array like so: $outputs = array(); while($row = mysql_fetch_array($query)) { $_SESSION['row_id'] = $row['id']; $outputs = $row['sport_ime'].' '.$row['sezona'].'<a href=../view/modifikacije.php> Edit</a><br>'; $_SESSION['output'] = $outputs; } and then on another page I call that variable like so: $outputs = $_SESSION['output']; echo ($outputs); It just echoes one row! It is the last entry in my database, why doesn't it want to echo everything? People at another site say that I am repeatedly overwriting the same variables! But I don't know how to avoid that
  9. Well yes I echo in my html file like so: <?php echo($_SESSION['result']); ?> in my backend php I do the session storage like so: while($row = mysql_fetch_array($query)) { $_SESSION['result'] = $row['sport_ime'].' '.$row['sezona'].'<br>'; } // and then redirect back to html where it should echo the stuff header('Location:../view/vnos.php',true,303); exit; The results you requested were just array => 0 and 1 for the last element in my array
  10. That is all fine and dandy but if I call this session in another file and try to echo it, it still displays only the last element of the array...
  11. wow jcbones, is that the code for the entire page?
  12. Oh damn I didn't see that break tag there, my bad! Would you also be so kind to post a solution, if you know one, how to make every row clickable so that user can access entries and modify/delete them? Also does anyone know how to store that line echo $row['sport_ime'].' '.$row['sezona'].'<br>'; inside $_SESSION variable correctly?
  13. no no, echo row just lists entire database in one row like so: "foo1988bar2000etc..." I want each new id in a new row ... I know there is something with for each() statement I just can't format it right
  14. Hey, I want to list all of my database entries to a nice html format. For every unique id there is one row displayed out from my database to my php/html. I just don't know how to do that. I tried using while loop and foreach I just don't know how to properly structure them... My query and php code looks like this: $query = mysql_query("SELECT * FROM sport"); while($row = mysql_fetch_array($query)) { $result = $row['sport_ime'].' '.$row['sezona']; }
  15. Lets say I have a form in form.php and when I click submit all inputted data is sent to model.php for database manipulation etc.. and then when everything is done the model.php redirects user back to form.php using function: header('Location:form.php'); How in the blazing hell can form.php recognize I was redirected there from model.php ? I am so lost about this for so long now, I tried $_SERVER['HTTP_REFERER'] and everything and I just get an echo with my current page location. I want to get an echo of the model.php on my form.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.