Jump to content


Photo

displaying of "New Entry.gif" or Update.gif


  • Please log in to reply
4 replies to this topic

#1 apophis

apophis
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 August 2006 - 01:10 PM

Hi,

I have a database and for searching the database by alfabetic letter I use this script

<?php 
$Search = $_GET['q'] ; 
// Connecting, CHANGE: servername, username and password 
$Connection = mysql_connect(.....) or die("Could not connect to database server"); 
// Selecting database, CHANGE: databasename 
mysql_select_db("") or die("Could not select database"); 

print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; 
print "<HTML>\n"; 

$QueryString1 = "SELECT * FROM dog_table WHERE DogName REGEXP '^$Search' ORDER BY DogName ASC"; 
//$QueryString = "SELECT RTRIM(DGName) AS Name FROM dog_table WHERE DogName REGEXP '^[^$Search.*'"; 
$result = mysql_query($QueryString1) or die("Syntax error pedigree.php (Query 1)"); 
$num_rows = mysql_num_rows($result); 
//print "number of rows = $num_rows\n"; 
while($row = mysql_fetch_array($result,MYSQL_BOTH)){ 
    $field=$row['DogName']; 
    $id=$row['Id']; 
    print "<a href=./pedigree.php?Id=$id"."&"."Gen=4>$field</a><br>"; 
} 
mysql_free_result($result); 


print "<HEAD>\n"; 
print "<TITLE>$Name</TITLE>\n"; 
print "<META name=\"Description\" content=\"$DGRegNam\">\n"; 
print "<META name=\"Keywords\" content=\"$DGRegNam\">\n"; 
print "</HEAD>\n"; 
print "<BODY>\n"; 
//print "search for letter $Search<br>"; 


print "</BODY>\n"; 

?> 

can someone help adjust this script so it have the function it will place an ubdit or new entry image.
the images are put in the directory of this script.
$Image_folder="./updateNew/";

what next, maybe with "strtotime()"

Thanks for the help ;)

#2 gerkintrigg

gerkintrigg
  • Members
  • PipPipPip
  • Magician
  • 828 posts
  • LocationBristol, UK
  • Age:37

Posted 04 August 2006 - 01:18 PM

ubdit or new entry image? What's that? are you trying to add the path to the database?

The ASC in your statement is not needed, it's set to ASC by default.

Oh, and "alphabetic" has no F in it. ;-)
Neil Trigger - http://www.ghostlypublishing.co.uk - Ghostly Publishing - Children's Fantasy Books

#3 apophis

apophis
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 August 2006 - 01:23 PM

Here is way maybe
$edit_date = "2006-08-01";  
$number_days = floor(abs((strtotime($edit_date)-time())/(60*60*24)));  

echo 'dit zijn '.$number_days.' dagen dus ';  

if($number_days<3){echo'updat.gif';}  
else{echo'';}  
Maybe something like this. But then for updat.gif as for new.gif

#4 apophis

apophis
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 August 2006 - 01:28 PM

yes now you say it is alphabetic and not like the dutch version of me alfabetisch, that comes if you think in 2 or even 3 languages, you are getting: "disordered, muddled, chaotic, incoherent, jumbled, foggy".  ;)

Can you help me adjust the script so it will give when the entry is new a new.gif or if it is updated a update.gif


#5 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 04 August 2006 - 02:20 PM

if($new){
echo "<img src='new.gif' />";
}else{
echo "<img src='notnew.gif' />";
}
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users