anthonydamasco Posted December 11, 2006 Share Posted December 11, 2006 As of right now my website has a "Job Search Feature" People looking for jobs can search, much like monster, or careerbuilder. Well in the back end I have small form for our staff to add jobs to the searchI can't seem to come up with a working script that will expire on days set by a form. For example if I say "this job expires 12/12/2006" it will remain searchable until that time. Can anyone point me in the right direction? Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/ Share on other sites More sharing options...
swatisonee Posted December 11, 2006 Share Posted December 11, 2006 You want a field with the expiry date added by your staff or you want the job itself to not show up on screen after 12/12/06 ? Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/#findComment-139138 Share on other sites More sharing options...
anthonydamasco Posted December 11, 2006 Author Share Posted December 11, 2006 i want a field that the staff can input what ever date they need that project to expire on Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/#findComment-139167 Share on other sites More sharing options...
swatisonee Posted December 12, 2006 Share Posted December 12, 2006 so cant you create a field in the table called expiry date and another called status ? then have a small sript called "expiry.php" where status gets set to off for each date (linked to serverdate)let me see if i can come up with some code... Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/#findComment-139425 Share on other sites More sharing options...
swatisonee Posted December 12, 2006 Share Posted December 12, 2006 [code]<form method="post" action="expiry1.php?staffid=<? echo $staffid ?>"><table border="0"><tr><td>Select job:</td><td><select name="a"><option value="">[Select One]<?phpmysql_connect("localhost", $dbname, $dbpasswd ) or die ("Unable to connect to server.");mysql_select_db($database) or die ("Unable to select database.");$result = mysql_query("SELECT * FROM `Job search` order by `whatever` ");if ($myrow = mysql_fetch_array($result)) { do { printf("<option value=%d> %s", $myrow["jobid"], $myrow["jobname"]); } while ($myrow = mysql_fetch_array($result)); echo "</select>\n";} else { echo "Sorry, no records were found!"; }?><font color="orange"> Mandatory field</font></td></tr><tr><td>Expiry date:</td><td><input type="text" name="b" size="20"></td></table><p><br><input type="submit" name="submit" value="Add"> </p></form>[/code]then expiry1.php can be where the above gets processed ...[code]<?php$a = $_POST["a"];$b = $_POST["b"];if (!$a || !$b) die("Mandatory information not entered. Please use back button of browser.");mysql_connect("localhost", $dbname, $dbpasswd ) or die ("Unable to connect to server.");mysql_select_db($database) or die ("Unable to select database.");$sql = "INSERT INTO `Job search (jid, expdate) VALUES ('$a','$b') ";$result = mysql_query($sql) or die (mysql_error());echo "<b>Information entered</b>";?>[/code]And when you view you can define :[code]<?tdate = date(Y-m-d) ;"Select * from job search where edate <= tdate " ; [/code] so that would bring up only current jobs.HTH Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/#findComment-139486 Share on other sites More sharing options...
anthonydamasco Posted December 12, 2006 Author Share Posted December 12, 2006 thats REALLY helpful!!! Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/#findComment-139627 Share on other sites More sharing options...
swatisonee Posted December 14, 2006 Share Posted December 14, 2006 actually [code]$sql = "INSERT INTO `Job search (jid, expdate) VALUES ('$a','$b') ";[/code]should have been [code]$sql = " UPDATE `Job search SET expdate = '$b' WHERE jid = $a ";[/code] Link to comment https://forums.phpfreaks.com/topic/30248-expire-search-entries/#findComment-141105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.