Jump to content

[SOLVED] Display date created of a filename


kochier

Recommended Posts

This is the code I am using to display date last modified

 

<?php

$file = $_SERVER["SCRIPT_NAME"];

$break = Explode('/', $file);

$pfile = $break[count($break) - 1];

//echo $pfile;

echo " Last Modified: " .date("m d Y",filemtime($pfile));

?>

 

And I was wondering if there was any simple way of displaying the date the file was created, I assumed it would be filectime for creation date, but after trying it I found the c stands for changed.

Alright well after some research into this I am beginning to wonder if it stores the info for created pages? I have also simplified my code somewhat, as I found the other code needlessly long, though I may be wrong.

 

<?php

echo " - " .date("m d Y", filemtime($_SERVER["SCRIPT_FILENAME"]));

?>

 

Is now what I am using to display last modified date, though I still can't figure out the creation date :(

Never mind, figured out about the script, I can include it, but wasn't configured to run .asp on the apache server. So this is what I have so far

 

<?php

include 'opendb.php';

mysql_select_db('sitemap') or die('Cannot select database');

include 'closedb.php';

?>

 

and this is what I want the db to look like:

 

name         pathname         created (m d Y) map

Main         index.php         10/24/2007         1

Absurdity absurdity.php 07/02/2008           2

 

or possibly combine the name and pathname into an href statement if possible (href=index.php Main).

 

Ok I've tried to insert code and my problem is nothing will show up now:

 

<?php

include 'opendb.php';

mysql_select_db('sitemap') or die('Cannot select database');

$sql = "CREATE TABLE map

(

Created date,

Name varchar,

Pathname varchar,

Map int

)";

mysql_query($sql);

mysql_query("INSERT INTO map (Created, Name, Pathname, Map)

VALUES ('2007-10-24', 'Main', 'index.php', '1')");

 

$result = mysql_query("SELECT * FROM map");

 

echo $result['Map'];

 

include 'closedb.php';

?>

 

I think it should echo "1" but nothing shows up when I run it.

<?php

include 'opendb.php';

mysql_select_db('sitemap') or die('Cannot select database');

$sql = "CREATE TABLE map

(

Created date,

Name varchar,

Pathname varchar,

Map int

)" or die ('Cannot create table');

 

mysql_query($sql) or die('Failure?');

mysql_query("INSERT INTO map (Created, Name, Pathname, Map)

VALUES ('2007-10-24', 'Main', 'index.php', '1')") or die('Failure to Insert data');

 

$result = mysql_query("SELECT * FROM map");

while($map=mysql_fetch_array($rsql))

{

echo $map['Map'];

 

 

include 'closedb.php';

?>

 

Is as far as I've gotten now. "Failure?" appears as my error, I can't figure out what's wrong with mysql_query though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.