Jump to content

apophis

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

apophis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have 2 tables $tblprefix.basenji and the $tblprefix.tracking The $tblprefix.basenji contains records and all records have unique basenji_id the $tblprefix.tracking is only having basenji_id e-mail and action (enum) = sub From the moment a person press "tracking" of a record, it happens and $tblprefix.tracking register the request in its tabel. basenji_id insert the id of that record from the table $tblprefix.basenji and the email of the person that is tracking that record. As function i am using: // function: track_person // send an email to everybody tracking an individual function track_person($basenji) { global $trackemail; global $tblprefix; global $err_person; global $eTrackSubject; global $eTrackBodyTop; global $eTrackBodyBottom; global $absurl; $tquery = "SELECT ".$tblprefix."basenji.basenji_id, name, email FROM ".$tblprefix."basenji, ".$tblprefix."tracking WHERE ".$tblprefix."basenji.basenji_id = ".$tblprefix."tracking.basenji_id AND ".$tblprefix."basenji.basenji_id = ".quote_smart($basenji)." AND `key` = '' AND expires = '0000-00-00 00:00:00'"; $tresult = mysql_query($tquery) or die($err_person); while ($trow = mysql_fetch_array($tresult)) { $headers = "Content-type: text/plain; charset=iso-8859-1\r\n"; $headers .= "From: <".$trackemail.">\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $subject = str_replace("$1", $trow["name"], $eTrackSubject); $body = str_replace("$1", $trow["name"], $eTrackBodyTop); $body = str_replace("$2", $absurl, $body); $body .= $absurl."basenji.php?basenji=".$trow["basenji_id"]."\n\n"; $body .= $eTrackBodyBottom; $body .= $absurl."track.php?basenji=".$trow["basenji_id"]."&action=unsub&email=".$trow["email"]."&name=".urlencode($trow["name"])."\n"; mail($trow["email"], $subject, $body, $headers); } mysql_free_result($tresult); } // eod of track_person() below the query of the update form i put if ($tracking) track_person($_REQUEST["basenji"]); What is wrong? $tracking = true I tried a lot and nothing works. ??? ??? ???
  2. I have a search page and try to split the result, as it is nicer to see, insted of 100 result to get it by 25 each. The code is doing everything it have to do, but every time i go to the next page, it starts indexing them again from 1 insted of 26,27,etcetera... I am a little tired of looking and at this moment i don't see the problem. Any suggestions. Here is the code i am using: <?php include('config.php'); error_reporting(E_ALL); function Print_Single ($SQL_search_Row) { $Id = $SQL_search_Row['Id']; $DOB1 = $SQL_search_Row['DOB']; $DOB = date('d M Y', strtotime($DOB1)); $Image_folder = "<img src=\"../pictures/andere/new.gif\" width=\"35\" height=\"15\" />"; $new = $Image_folder; $bewerk_datum = $SQL_search_Row['DOC']; $aantal_dagen = floor(abs((strtotime($bewerk_datum)-time())/(60*60*24))); $Image_folder2 = "<img src=\"../pictures/andere/update.gif\" width=\"47\" height=\"10\" />"; $update = $Image_folder2; $bewerk_datum2 = $SQL_search_Row['DOU']; $aantal_dagen2 = floor(abs((strtotime($bewerk_datum2)-time())/(60*60*24))); print "<span class=\"style2\">".$SQL_search_Row['Ch']."</span>\n"; print "</a>&nbsp"; print "<span class=\"style3\">".$SQL_search_Row['DogName']."</span"; print "</a>&nbsp"; print "<span class=\"style4\">(".$SQL_search_Row['Color'].")</span>"; print "</a>&nbsp"; print "<span class=\"style4\">".$DOB."</span>"; print "</a> &nbsp&nbsp"; if($aantal_dagen <60){echo $new;} else{echo'';} if($aantal_dagen2 <60){echo $update;} else{echo'';} print "<br><font color='black' size='1' face='Arial'>"; print "[<a href=\"pedigree.php?Id=$Id\">Pedigree]</a> "; print "[<a href=\"breeding.php?Id=$Id\">Breeding]</a> "; print "[<a href=\"sibling.php?Id=$Id\">Sibling]</a></font>"; } // Added for splitting the pages $RowPerPages = 25 ; $PageNumber = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $PageNumber = $_GET['page']; } $offset = ($PageNumber - 1) * $RowPerPages; $var = $_GET['q']; // Get the search variable from URL $trimmed = trim($var); //trim whitespace from the stored variable // check for an empty string and display a message. if ($trimmed == "") { print "<p>Please enter a search...</p>"; exit; } print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; print "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; print "<head>"; print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />"; print "<title>Searching the database</title>"; print "</head>"; print "<body>"; print "<p <span align=\"center\" class=\"style1\">Searching database - here are the entries that match: ".$trimmed."</span></p>\n"; print "<br>"; $SQL_search = "SELECT * FROM $table WHERE DogName Like \"%$trimmed%\" ORDER BY DogName LIMIT $offset, $RowPerPages"; $SQL_search_Result = mysql_query($SQL_search) or die(mysql_error()); // keeps getting the next row until there are no more to get if (mysql_num_rows($SQL_search_Result) >0){ $a = 1; while($SQL_search_Row = mysql_fetch_array( $SQL_search_Result)) { // Print out the contents of each row into a table print "<table width=\"60%\" border=\"1\" bgcolor=\"#00FFFF\">"; print "<tr>"; print "<td width=\"10%\"><div align=\"center\"><strong>".$a."</strong></div></td>"; print "<td width=\"90%\"><div align=\"left\">"; echo Print_Single($SQL_search_Row); print "</div></td></tr>"; print "</table>"; $a++; } } echo "</table>"; print "<body>"; $query = "SELECT * FROM $table WHERE DogName Like \"%$trimmed%\""; $result = mysql_query($query) or die('Error, query failed'); $numrows =mysql_num_rows($result); //print "number of rows = $numrows"; // how many pages we have when using paging? $maxPage = ceil($numrows/$RowPerPages); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($PageNumber > 1) { $page = $PageNumber - 1; $prev = " <a href=\"$self?q=$trimmed&page=$page\">[Prev]</a> "; $first = " <a href=\"$self?q=$trimmed&page=1\">[First Page]</a> "; } else { $prev = ' [Prev] '; // we're on page one, don't enable 'previous' link $first = ' [First Page] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($PageNumber < $maxPage) { $page = $PageNumber + 1; $next = " <a href=\"$self?q=$trimmed&page=$page\">[Next]</a> "; $last = " <a href=\"$self?q=$trimmed&page=$maxPage\">[Last Page]</a> "; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link } // print the page navigation link echo $first . $prev . " Showing page <strong>$PageNumber</strong> of <strong>$maxPage</strong> pages " . $next . $last; print "</body>"; print "</html>"; ?>
  3. Hope some one can help me with my problem: With an url I get a number: [code] <? $Id = (isset($_GET['Id'])) ? intval($_GET['Id']) : 0 ;  $where = ($Id != 0) ? " WHERE Id=".$Id : " "; ?> [/code] With this I can find the number and of records of the $Id and $FatherId and $MotherId: [code] <? $SQL_parents = "SELECT FatherId, MotherId FROM dog_table WHERE Id = '".$Id."'" or die(mysql_error());     $SQL_parents_Result = mysql_query($SQL_parents);         if ($SQL_parents_Result) {            $parents_row = mysql_fetch_assoc($SQL_parents_Result);            $MotherId = $parents_row['MotherId']; //De nummer van de Moeder           $FatherId = $parents_row['FatherId']; //De nummer van de Vader ?> [/code] Now i want to find the unique records with the information I have with the help of a query: This will give me again numbers and with this number i can find there records with a query. The numbers I get from that distinct query are (6638,6642,6691,7470,7476) [code] <?     $SQL_distinct_mother = "SELECT DISTINCT MotherId FROM dog_table where FatherId = $FatherId and MotherId != $MotherId and Id != $Id";     $SQL_distinct_mother_result = mysql_query($SQL_distinct_mother) or die(mysql_error());                 if ($SQL_distinct_mother_result) {                  $numRows = mysql_num_rows($SQL_distinct_mother_result);                for ($x=0;$x<$numRows;$x++) {                    $row = mysql_fetch_array($SQL_distinct_mother_result);                //print $row['MotherId'];               //print $row."<br>";                              foreach ($row as $sValue) {                       $sql = "SELECT * FROM dog_table WHERE Id = '". $sValue ."'";                       $sql_result = mysql_query($sql) or die(mysql_error());                       $sql_row = mysql_fetch_assoc($sql_result);                   print $sql_row['Id']."<br>";                                         }        }     } ?> [/code] This should be the output but now but : 6638 6642 6691 7470 7476 I am getting this 6638 6638 6642 6642 6691 6691 7470 7470 7476 7476 What do I wrong?
  4. 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. 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
  6. 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 ;)
×
×
  • Create New...

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.