Jump to content


  • Posts

  • Joined

  • Last visited

About Gyohdon

  • Birthday 04/06/1993

Previous Fields

  • Languages
    Only parts of HTML and PHP and even less of JavaScript

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location
    Behind my computer.

Gyohdon's Achievements


Member (2/7)



  1. Maybe he should change it into VARCHAR? That way both the dollar sign and the price are stored.
  2. Are the files using it/linking to it in your root folder, without using an extended path? If yes, then yes.
  3. I have said this three times. You left it open and needed to close it.
  4. Gyohdon

    Pageview Counter

    Exactly.So, without further ado, my little epoch-datetime difference experiment!<?php//Connect to DB, insert your info$database = "DB";$mysql_servername = "localhost";$mysql_user = "root";$mysql_password = "";$con = mysql_connect($mysql_servername, $mysql_user, $mysql_password);if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db($database, $con);//Connected to DB//Create Main Pageecho '<html><body> <form action="testdate.php" method="post"> Choose mode: <select name="mode"> <option value="Insert">Insert</option> <option value="Result">Result</option> </select> <input type="submit" value="Mode" /></form>';if (isset($_POST['mode'])) { if ($_POST['mode'] == 'Insert') { $time = date("U"); $mysql = mysql_query("INSERT INTO `Datetime` VALUES ('$time')"); if (!$mysql) { die('Error: ' . mysql_error()); } echo 'Succesfully inserted ' . $time . '<br />'; echo '<a href="testdate.php">Click here to return</a>'; } elseif ($_POST['mode'] == 'Result') { $query = mysql_query("SELECT * FROM `Datetime` ORDER BY Date DESC LIMIT 1"); if (!$query) { die('Error: ' . mysql_error()); } $row = mysql_fetch_array($query); $var1 = $row['Date']; $var2 = date("U"); echo '<br />'; echo '<br />'; echo '<br />'; echo 'var1 is: ' . $var1; echo '<br />'; echo 'var2 is: ' . $var2; echo '<br />'; echo '<br />'; echo '<br />'; $result = $var2 - $var1; echo 'result is: ' . $result; echo '<br />'; echo '<br />'; if ($result < 100) { echo 'Difference between two datetimes is less than 100 seconds'; } else { echo 'Difference between two datetimes is more than 100 seconds'; } echo '<br />'; echo '<br />'; echo 'Succesfully calculated the difference.<br />'; echo '<a href="testdate.php">Click here to return</a>'; } }//Close everything offmysql_close($con);echo '</body></html>';?>
  5. Gyohdon

    Pageview Counter

    Back. It worked. If you would like to test it out yourself I could give you the code I just wrote to test it myself. Anyway, I can use this to calculate the amount of seconds between two datetimes, which makes me very happy.
  6. Gyohdon

    Pageview Counter

    Wow, this will take some time testing. Anyway, I'll be back with some results.
  7. Look at your very first if-statement. It is open right now. You need to place a '}' where you would close it.
  8. Yes. That's what I meant when I said it wasn't closed.
  9. Your very first if statement is never closed. There is one } bracket missing
  10. Bolded parts seem like they might be syntax problems.
  11. Gyohdon

    Pageview Counter

    So, if $var1 and $var2 would be stored with date("U"), would this work?$result = $var2 - $var2;if ($result < 100){//Difference between two datetimes is less than 100 seconds}else{//Difference between two datetimes is more than 100 seconds}
  12. Gyohdon

    Pageview Counter

    If I were to use date("U") and store that seperately, then subtract a later date("U") with the old one, would I get the seconds in difference?Would it return the actual amount of seconds?
  13. Try using this link whenever you have syntax errors.
  14. Gyohdon

    Pageview Counter

    EDIT 2: Okay, now I need to calculate the difference between two datetimes.I was just wondering, is there a datetime-difference function in php?
  • Create New...