questo e il mio codice:
codice:
$connessione=mysql_connect('localhost','root','') or die("no connect". mysql_error());
mysql_select_db('dominator') or die("no db");
session_name('Dominatorsession');
session_start();
$data_di_oggi=date("Y-m-d H:i:s");
$sql=mysql_fetch_array(mysql_query("SELECT TIME_FORMAT(TIME_DIFF(".$data_di_oggi.",utenti.Data_Iscrizione),%H) AS ore FROM utenti WHERE utenti.UserName='".$_SESSION['username']."'")) or die("Impossibile prendere le ore".mysql_error());
echo "ore trascorse ".$sql[ore];
mysql_close($connessione);
e questo e l'output:
codice:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\appserv\www\tesina\pop-up\universo\home.php on line 13
Impossibile prendere le ore You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(2007-03-23 14:44:25,utenti.Data_Iscrizione),%H) AS ore FROM ut
Puo essere che i commandi time_format e time_diff siano di php5 (perche mi sono dimenticato di dire che uso php 4 per motivi al di fuori della mia portata che non sto qui a spiegare)