wwfc_barmy_army Posted September 18, 2006 Author Share Posted September 18, 2006 Sorry about the late reply.It doesn't show anything. No errors. ???Peter. Quote Link to comment Share on other sites More sharing options...
pkSML Posted September 18, 2006 Share Posted September 18, 2006 OK. Delete the while loop.Put this code in its place:[code]print "<PRE>";print_r($qry);print "</PRE>";[/code]Is there any output from the array? If so, what is it?-----------------BTW, what is this script used for? Is it a script that lists several entries or is it just supposed to list information about a single entry? Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted September 19, 2006 Author Share Posted September 19, 2006 The script lists information from one record (which is currently just rubbish typed in) but this is what the array said:[quote]Array( [0] => 9 [id] => 9 [1] => cx [name] => cx [2] => vcxvx [sitelink] => vcxvx [3] => xbv [sitedownload] => xbv [4] => 2006-09-13 [dateadded] => 2006-09-13 [5] => xbvb [publisher] => xbvb [6] => Pujhjdshfksjdhfjkhsdjkhfs [publisherinfo] => Pujhjdshfksjdhfjkhsdjkhfs [7] => 0 [filesize] => 0 [8] => bxcb [limitations] => bxcb [9] => vcxbvxv [requirements] => vcxbvxv [10] => 3D [graphics] => 3D [11] => bvxxcbvxbv [review] => bvxxcbvxbv [12] => vbbvxv [pros] => vbbvxv [13] => vcbxbvbvx [cons] => vcbxbvbvx [14] => 0 [editorrating] => 0 [15] => [screenshot] => [16] => 0 [rating] => 0 [17] => 0 [num_votes] => 0 [18] => 0 [clicks] => 0)[/quote] Quote Link to comment Share on other sites More sharing options...
pkSML Posted September 19, 2006 Share Posted September 19, 2006 OK, great! I think the problem is solved.Turns out you don't even need that while loop.[code]<?phpdate_default_timezone_set("US/Eastern");list($year, $mon, $day) = explode('-', $qry[dateadded]);$sevenDays = (7 * 24 * 60 * 60); // 604,800 seconds in 7 days$entryTime = strtotime("$year-$mon-$day");$now = strtotime("now");if (($now - $entryTime) < $sevenDays){echo "<img src='/images/new.gif'>";}?>[/code]What are the results of this code? Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted September 20, 2006 Author Share Posted September 20, 2006 :( Still doesn't show anything for some reason. I even tried changing the date so it's today, but still nothing. :(Any other ideas? ???Thanks for all your help.Peter. Quote Link to comment Share on other sites More sharing options...
pkSML Posted September 20, 2006 Share Posted September 20, 2006 [code]<?phpdate_default_timezone_set("US/Eastern");list($year, $mon, $day) = explode('-', $qry[4]);$sevenDays = (7 * 24 * 60 * 60); // 604,800 seconds in 7 days$entryTime = strtotime("$year-$mon-$day");$now = strtotime("now");if (($now - $entryTime) < $sevenDays){echo "<img src='/images/new.gif'>";}else{echo "<PRE>";echo "This script is mind-boggling!";echo '$qry[4] --> '.$qry[4]."\n";echo '$now --> '.$now."\n";echo '$entryTime --> '.$entryTime."\n";echo '$sevenDays --> '.$sevenDays."\n";echo '$year-\$mon-\$day --> '.$year."-".$mon."-".$day."\n";echo "<PRE>";}?>[/code]This script had better produce some output! That's why I added the else{} statement.If things don't work right: Please post the output of this snippet. Also email or post your source for site.php. I'll look for any syntax errors. Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted September 20, 2006 Author Share Posted September 20, 2006 This has got to be the worst php problem i have come across in my 2 weeks of learning :PThe script shows nothing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.