This is the code for my TV guide website (stored on localhost)'s articles in PHP:

<?php
//connect to mysql
//change user and password to your mySQL name and password
mysql_connect("localhost","root","PASSWORDREMOVED"); 
	
//select which database you want to edit
mysql_select_db("tvguide"); 

//select the table
$result = mysql_query("select * from epdata");

//grab all the content
while($r=mysql_fetch_array($result))
{	
   //the format is $variable = $r["nameofmysqlcolumn"];
   //modify these to match your mysql table columns
   $programme=$r["programme"];
   $channel=$r["channel"];
   $airdate=$r["airdate"];
   $episode=$r["episode"];
   $setreminder=$r["setreminder"];
echo "<tr><td><b>$programme</b></td><td>showing on $channel</td><td>$airdate</td><td>$episode</td><td>$setreminder</td></tr>";
}
?>

The above works well, extracts data from SQL as I want it to do - but, the problem is trying to get data to display like this:

House M.D. showing on Channel1 December 15th - 7:00pm "Episode" Set Reminder

I can't get the timestamp to set the values as:
(value for date and time programme airs)

December 25th - 6:30pm

and then when it is that day or time, it just automatically shows it as:
(value for time programme airs)

7:00pm

and then, in SQL, automatically deleting the record after a certain time (e.g. in this case, the programme is an hour long, so it would have to delete the record by 8:00pm - well, UK time anyway!)

I am using PhpMyAdmin to edit the data, for the record, so if anyone knows how to fix this I'd appreciate it - I have tried to Google for info on this but didn't find much.

I'm doing this on localhost on an Apache server, so I don't have access to cron jobs or anything like that.

I hope I have explained my situation well enough, and all advice is appreciated.

I have tried again to solve this, but no luck so far...

have you tried the DateTime:modify() function to set the date in desired format.

How would I use this in conjunction with my database records?
Also:

Then when it is that day or time the program airs, it just automatically shows it as:
(value for time programme airs)
7:00pm

Also, how in SQL, automatically deleting the record after a certain time (e.g. in this case, the programme is an hour long, so it would have to delete the record by 8:00pm - well, UK time anyway!)
I think TRIGGER could work but when I tried it gave error 1064 messages - I'm new to this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.