Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
date of the last added Link

Posted by torriv (torriv), 6 August 2007

I have a little problem that my code will not give me the right date. it only gives me: 1/1/1970

the code is:

include "admin/connect.php";
include "admin/var.php";
//main module for chipmunk FFAL script
 $getcatlink="SELECT * from ffal_categories where ID='$ID'";
 $getcatlink2=mysql_query($getcatlink) or die("Could not get catname");
 print "<A href='index.php'>Hjem</a>--><A href='index.php?catid=".$getcatlink3['ID']."'>".$getcatlink3['catname'] ."</a><br><br>";
 print "<center><h3> .:". $getcatlink3['catname'] ."</h3></center>";
 print "<center><A href='addlink.php'>Legg til en link</a></center><br><br>";
 $getlinks="SELECT * from ffal_links where catparent='$ID' limit $numlinks";
 $getlinks2=mysql_query($getlinks) or die(mysql_error());
   $getlinks3[description]=wordwrap($getlinks3[description], 25, "\n", 1);
     print "<center>";
   print "<A href='".$getlinks3['url']."' target='_blank'>".$getlinks3['title']."</a> - ";

        print $getlinks3['Description']."<br>------------------------------------------------------------ <br>";

 $getcategories="SELECT * from ffal_categories";
 $getcategories2=mysql_query($getcategories) or die(mysql_error());

$catparent="select catparent from ffal_links";
$catparent2=mysql_query($catparent) or die("funker dårlig");
print "<table border='0' cellspacing='10' align='center'>";
print "<tr><td colspan='2'><center><h3>Linker</h3></center><br><center>Det er $catparent3 Linker registrert</center></td></tr>";
while($getcategories3=mysql_fetch_array($getcategories2)) {
      $siste_link= mysql_query("SELECT time FROM `ffal_links` WHERE catparent = " . $getcategories3['ID'] ."");
      $siste_link1 = mysql_fetch_array($siste_link);
      $siste_link3 = date("j/n/Y",$siste_link1);
      $catparent="select catparent from ffal_links WHERE catparent=" . $getcategories3['ID'];
      $catparent2=mysql_query($catparent) or die("funker dårlig");
          if($count%2==0) {
                print "<tr><td><A href='index.php?catid=" . $getcategories3['ID']."'><b>".$getcategories3['catname']."</b></a> <br>Antall - ($catparent3) <br> Siste lagt til: ";
                if (mysql_num_rows($siste_link) == 0) print "Ingen.";
                else print $siste_link3;
                print "<br></td>";
          } else {
                print "<td><A href='index.php?catid=".$getcategories3['ID']."'><b>".$getcategories3['catname']."</b></a> <br>Antall - ($catparent3)<br> Siste lagt til: ";
                if (mysql_num_rows($siste_link) == 0) print "Ingen.";
                else print $siste_link3;
                print "<br></td>";
 print "<tr><td colspan='2'><center><A href='addlink.php'>Legg til en link</a></center></td></tr>";
 print "</table>";
include 'critical.php';

siste_link is the norwegian word for last link..

can you see any obvious error?

adress to the page is:

Posted by admin (Graham Ellis), 7 August 2007
mysql_fetch_array returns an array.  Try replacing      
$siste_link1 = mysql_fetch_array($siste_link);
$siste_link3 = date("j/n/Y",$siste_link1);

$siste_link1 = mysql_fetch_array($siste_link);
$siste_link3 = date("j/n/Y",$siste_link1[0]);

Posted by torriv (torriv), 7 August 2007
yes! that worked!

can you tell me a little about what [0] does?

Thank you very much again!

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho