Jump to content
php.lv forumi

No time(); uz date();


Recommended Posts

Kā pareizi jāizvelk no db tas datums un laiks? Es darīju šādi:


		echo "<table>";
	echo "<tr><th>#</th><th>Ieraksts</th><th>Laiks</th></tr>";

	$sql = "SELECT * FROM log ORDER BY id desc";
	$res = mysql_query($sql);
	while ($r = mysql_fetch_assoc($res)) {
		$laiks = date("m.d.y, H:i:s", $r['time']);
		echo "<tr><td>$r[id]</td><td>$r[name]</td><td>$laiks</td></tr>";
	echo "</table>";

Bet tik reizes cik ir tas while, tik reizes uzmetās errors (tikai pirmais rezultāts strādāja bez erroriem)

Warning: date() expects parameter 2 to be long, string given in C:\..\log.php on line 16
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...