![]() |
|
#1
|
|||
|
|||
TimestampOk JDS its my day for questions
I have a time stamp in my news table. If I recall 1 line it works ok using PHP Code:
to translate. However if I recall all the news items using PHP Code:
It all goes pear shaped. How can I include the top code to translate my timestamp on all the news items? I now know I cannot mix my code (thanks to you answering my last posting) and as soon as I look at a manual I get dyslexic I prefer the trial and error (lots of error) and then the ask JDS route. ![]() |
|
#2
|
||||
|
||||
|
Describe the `news` table if you can, so we can refer to it when we need to.
Also, you will need to extend... Code:
and actually list all the field names before I can suggest what you can try... e.g. Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
My news table structure is
`newsid` int(11) NOT NULL auto_increment, `competid` int(11) NOT NULL default '0', `headline` varchar(255) NOT NULL default '', `lead` longtext NOT NULL, `details` longtext NOT NULL, `writer` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', `pageupdate` timestamp(14) NOT NULL, When I recall the news item I want to be able to transform the time stamp. I have been using the code in the earlier poting to transform the timestamp. To recall I am using PHP Code:
Any help would be grateful as I am confused again for a change. |
|
#4
|
||||
|
||||
Using MySQL date function: DATE_FORMAT()I wrote one article a while back about this: http://www.desilva.biz/mysql/formatdate.html
Anyway, looking at your code above, it seems to me that you want your TIMESTAMP formatted like this: Code:
Instead of 'formatting' the date via PHP, I (personally) prefer to do it via MySQL, so here's what you can try too: PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
|||
|
|||
|
Thanks JDS.
I changed a few things because I wanted to read from 2 table; PHP Code:
If you notice on the last line I changed to mysql_fetch_array from mysql_fetch_assoc because it wouldnt work until I did this. Everything seems to work ok but can you tell me if this may cause problems. Thanks again. |
|
#6
|
||||
|
||||
|
No, it won't cause any problems... just one small comment to add before we're done with this thread:
`newsid`, `counter`.`idnews` and even the variable $newsid are the SAME (or should be). You can just use $newsid where you needed to insert the others, no? BTW, I assume you've already done this, right at the top of your script? PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#7
|
|||
|
|||
|
OK
$newsid = intval( $_GET['newsid'] ); ?> but I have now. The <? $newsid ?> was called from the page recall but I have included it now. It worked before but hopefully adding the extra code is an extra safeguard. ??? If not, anybody else doing the same will know to add it to get the code to 'operate' correctly. I dont claim I am an expert but with lots of help I get by ![]() |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The