apophis Posted August 4, 2006 Share Posted August 4, 2006 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 ;) Link to comment https://forums.phpfreaks.com/topic/16537-displaying-of-new-entrygif-or-updategif/ Share on other sites More sharing options...
gerkintrigg Posted August 4, 2006 Share Posted August 4, 2006 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. ;-) Link to comment https://forums.phpfreaks.com/topic/16537-displaying-of-new-entrygif-or-updategif/#findComment-69131 Share on other sites More sharing options...
apophis Posted August 4, 2006 Author Share Posted August 4, 2006 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 Link to comment https://forums.phpfreaks.com/topic/16537-displaying-of-new-entrygif-or-updategif/#findComment-69136 Share on other sites More sharing options...
apophis Posted August 4, 2006 Author Share Posted August 4, 2006 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 Link to comment https://forums.phpfreaks.com/topic/16537-displaying-of-new-entrygif-or-updategif/#findComment-69138 Share on other sites More sharing options...
onlyican Posted August 4, 2006 Share Posted August 4, 2006 if($new){echo "<img src='new.gif' />";}else{echo "<img src='notnew.gif' />";} Link to comment https://forums.phpfreaks.com/topic/16537-displaying-of-new-entrygif-or-updategif/#findComment-69173 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.