Jump to content

Archived

This topic is now archived and is closed to further replies.

apophis

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

Recommended Posts

Hi,

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

[code]
<?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";

?>
[/code]

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 ;)

Share this post


Link to post
Share on other sites
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. ;-)

Share this post


Link to post
Share on other sites
Here is way maybe
[code]
$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'';}  
[/code]
Maybe something like this. But then for updat.gif as for new.gif

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
if($new){
echo "<img src='new.gif' />";
}else{
echo "<img src='notnew.gif' />";
}

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.