Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts

    search to display results = postings within the last 4 days

    I am trying to put a script into my search that would only display postings that were posted within or = to the last 4 days.

    I would really like to have the postings become inactive automatically (flag) after 4 days but I haven't been able to come up with that solution either.

    I am using perl/cgi with mysql.

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,872
    Thanks
    2
    Thanked 164 Times in 159 Posts
    Post your code, specifically the portion that you're testing to accomplish this task along with any related code and point out where you're having trouble.

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Your MySQL query could filter out those messages that are >4 days old. You'd need to have a column in your table that stores the date/time the record was added (perhaps, use the datetime format for the column), and search for those records that are <= 4 days ago. look up 'interval' in the mysql docs.

    hth

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #4
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bazz View Post
    Your MySQL query could filter out those messages that are >4 days old. You'd need to have a column in your table that stores the date/time the record was added (perhaps, use the datetime format for the column), and search for those records that are <= 4 days ago. look up 'interval' in the mysql docs.

    hth

    bazz
    I do already have a column that has both date & time, its called updated. Anytime some edits the posting that changes which is exactly what I would want to go off of.

    The code that I have in the search. I have tried several other things with non of it working:

    Code:
    %%PERL: @$orig= $_GET['ship1_orig_state'];%%
    %%PERL: if( is_array($orig)){%%
    %%PERL: while (list ($key, $val) = each ($orig)) {%%
    
    THIS CODE---->>>%%PERL: SELECT something FROM 'updated'
        -> WHERE DATE_SUB(CURDATE(),INTERVAL 4 DAY) <= 'updated'; <------
    
    %%PERL: echo "$val <br>";%%
    %%PERL: }%%
    %%PERL: }//else{echo "not array";}%%

  • #5
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts
    anyone?

  • #6
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,872
    Thanks
    2
    Thanked 164 Times in 159 Posts
    That is not normal Perl syntax.

    What framework are you using?

  • #7
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Everything I am using on my site is mysql, cgi & perl

    My site was originally programmed by someone else and I am trying to modify it a bit more.

    I am also having a seperate issue with not being able to select more then one state in my search.... I will post that in another thread.

  • #8
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by awayne96 View Post
    Everything I am using on my site is mysql, cgi & perl

    My site was originally programmed by someone else and I am trying to modify it a bit more.

    I am also having a seperate issue with not being able to select more then one state in my search.... I will post that in another thread.
    why the line in your code start with %%PERL: and ends with %%?

    best regards

  • #9
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,872
    Thanks
    2
    Thanked 164 Times in 159 Posts
    Code:
    %%PERL: @$orig= $_GET['ship1_orig_state'];%%
    That is not Perl (by Larry wall) syntax.

    Code:
    %%PERL: echo "$val <br>";%%
    Perl Does not have an echo function.

    Code:
    %%PERL: while (list ($key, $val) = each ($orig)) {%%
    The proper Perl syntax for that line is
    Code:
    while( my ($key, $value) = each %orig ) {
    Your code looks like a combination of ASP, PHP, and Perlscript (from Microsoft, which is not the same as Perl).

  • #10
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Thanks for the responses.

    I was told by the programmer that it was perl, cgi & mysql. I did forget the he did also say that there was alittle of php also.

    Maybe this is also why the multiple state selection doesn't work since this is not perl syntax? If I select 2 states in the multiple box, the first state selection is the only state that is displayed in the results. But more on that once I solve this issue.

    So what is the correct way of getting this data to only display the last 4 day postings?

    Also, the coding that I posted is actually on the search page... below the search button.

  • #11
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by awayne96 View Post
    Thanks for the responses.

    I was told by the programmer that it was perl, cgi & mysql. I did forget the he did also say that there was alittle of php also.

    Maybe this is also why the multiple state selection doesn't work since this is not perl syntax? If I select 2 states in the multiple box, the first state selection is the only state that is displayed in the results. But more on that once I solve this issue.

    So what is the correct way of getting this data to only display the last 4 day postings?

    Also, the coding that I posted is actually on the search page... below the search button.
    post a link if you can, maybe we can guess what's happend there.

    best regards

  • #12
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,872
    Thanks
    2
    Thanked 164 Times in 159 Posts
    In addition to the link that oesxyl requests, I think we also need a larger sample of your code that processes the submission/request. I you can, I'd like to see the entire script.

  • #13
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    post a link if you can, maybe we can guess what's happend there.

    best regards
    I would love to but it is password protected since you have to be a member but I will post the code in the next post.
    Last edited by awayne96; 11-19-2009 at 03:04 AM.

  • #14
    New Coder
    Join Date
    Oct 2009
    Posts
    70
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Here is my code for that whole page:

    Code:
    %%TAB:tab%%
    %%TEMPLATE:header%%
    
    
    
    <script LANGUAGE="JavaScript">
    <!--
    
    var b = 0 ;
    var i = 0 ;
    var errmsg = "" ;
    var punct = "" ;
    var min = 0 ;
    var max = 0 ;
    
    function formbreeze_email(field) {
    
    	if (b && (field.value.length == 0)) return true ;
    
    
    	if (! emailCheck(field.value))
    	  {
    		  field.focus();
    		  if (field.type == "text") field.select();
    		  return false ;
    	  }
    
       return true ;
    }
    
    function formbreeze_filledin(field) {
    
    if (b && (field.value.length == 0)) return true;
    
    if (field.value.length < min) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false ;
       }
    
    if ((max > 0) && (field.value.length > max)) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false ;
       }
    
    return true ;
    }
    
    function formbreeze_number(field) {
    
    if (b && (field.value.length == 0)) return true ; ;
    
    if (i)
     var valid = "0123456789"
    else
     var valid = ".,0123456789"
    
    var pass = 1;
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") pass = 0;
    
    }
    
    if (!pass) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false;
     }
    
    if (field.value < min) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false;
       }
    
    
    if ((max > 0) && (field.value > max)) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false;
       }
    
    return true ;
    }
    
    
    function formbreeze_numseq(field) {
    
    
    if (b && (field.value.length == 0)) return true ;
    
    var valid = punct + "0123456789"
    
    var pass = 1;
    var digits = 0
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") pass = 0;
    if (valid.indexOf(temp) > (punct.length-1) ) digits++ ;
    
    }
    
    if (!pass) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false ; ;
       }
    
    if (digits < min) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false;
       }
    
    if ((max > 0) && (digits > max)) {
    alert(errmsg);
    field.focus();
    if (field.type == "text") field.select();
    return false;
       }
    
    return true ;
    }
    
    function emailCheck (emailStr) {
    
    var checkTLD=1;
    var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|ws)$/;
    var emailPat=/^(.+)@(.+)$/;
    var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
    var validChars="\[^\\s" + specialChars + "\]";
    var quotedUser="(\"[^\"]*\")";
    var atom=validChars + '+';
    var word="(" + atom + "|" + quotedUser + ")";
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
    var matchArray=emailStr.match(emailPat);
    
    if (matchArray==null) {
    alert(errmsg);
    return false;
    }
    var user=matchArray[1];
    var domain=matchArray[2];
    
    for (i=0; i<user.length; i++) {
    if (user.charCodeAt(i)>127) {
    alert(errmsg);
    return false;
       }
    }
    for (i=0; i<domain.length; i++) {
    if (domain.charCodeAt(i)>127) {
    alert(errmsg);
    return false;
       }
    }
    
    if (user.match(userPat)==null) {
    alert(errmsg);
    return false;
    }
    
    var atomPat=new RegExp("^" + atom + "$");
    var domArr=domain.split(".");
    var len=domArr.length;
    for (i=0;i<len;i++) {
    if (domArr[i].search(atomPat)==-1) {
    alert(errmsg);
    return false;
       }
    }
    
    if (checkTLD && domArr[domArr.length-1].length!=2 &&
    domArr[domArr.length-1].search(knownDomsPat)==-1) {
    alert(errmsg);
    return false;
    }
    
    if (len<2) {
    alert(errmsg);
    return false;
    }
    
    return true;
    }
    
    function formbreeze_sub()
    {
    /*
    //FBDATA:in_ship1_orig_state^0^1^55^0^Field "in_ship1_orig_state" must be filled in.:;:;
    */
    b=0;
    errmsg="Field \"in_ship1_orig_state\" must be filled in.";
    min=1;
    max=55;
    if (! formbreeze_filledin(document.shipper.in_ship1_orig_state) ) return false ;
    
    }
    -->
    </script>
    <!-- FORMBREEZE-END -->
    </head>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tbody>
         <tr>
    	    <td width="100%" height="25" bgcolor="#8DD822"><img 
    		    src=images/curve.gif width=15 height=25>
    		    <font face="Georgia" size="2" color="#ffffff"><b>
    
         Load Listing Search
    
       </font></td>      
     </b>
    </tr>       
    </tbody>    
    </table>  
    <table width="100%" border="0" cellspacing="3" cellpadding="3" bgcolor="ffffff">
    <tbody>     
    <tr>        
    <td>    
    <form action=/pmpre4/cgi/search.cgi?action=searchwiz&do=question_form_code&name=shipper method=get>
    <input type=hidden name=action value=app_search>
          <input type=hidden name=app value="ship1">
     <input type="hidden" name="sortby" value="ship1_orig_city">
     <input type=hidden name=reverse value=no>
     <input type=hidden name=attitude value=minimum>
     <input type=hidden name=temp_page value=search_load_search>
     <input type=hidden name=temp_table value=search_load_search_table>
     <input type=hidden name=rpp value=100>
    
    
    
    
    
    
    <table border=0>
        <tr>
       <td><font size=“2” face="Georgia" color="green">Company Name</td>
       <td>
       <input type='text' size='20' name='in_login'  >
       </td>
      </tr>
    <tr>
    
     
       <td><font size=“2” face="Georgia" color="green">Origination State</td>
      
    	<td valign=left>
    			<select name=in_ship1_orig_state multiple size=5>
    
         	<option %%SELECTED:in_ship1_orig_state%%></option>
     	<option  %%SELECTED:in_ship1_orig_state:Alabama%%>Alabama</option>
    	<option %%SELECTED:in_ship1_orig_state:Alaska%%>Alaska</option>
    	<option %%SELECTED:in_ship1_orig_state:Arizona%%>Arizona</option>
    	<option %%SELECTED:in_ship1_orig_state:Arkansas%%>Arkansas</option>
    	<option %%SELECTED:in_ship1_orig_state:California%%>California</option>
    	<option %%SELECTED:in_ship1_orig_state:Colorado%%>Colorado</option>
    	<option %%SELECTED:in_ship1_orig_state:Connecticut%%>Connecticut</option>
    	<option %%SELECTED:in_ship1_orig_state:District of Columbia%%>District of Columbia</option>
    	<option %%SELECTED:in_ship1_orig_state:Delaware%%>Delaware</option>
    	<option %%SELECTED:in_ship1_orig_state:Florida%%>Florida</option>
    	<option %%SELECTED:in_ship1_orig_state:Georgia%%>Georgia</option>
    	<option %%SELECTED:in_ship1_orig_state:Hawaii%%>Hawaii</option>
    	<option %%SELECTED:in_ship1_orig_state:Idaho%%>Idaho</option>
    	<option %%SELECTED:in_ship1_orig_state:Illinois%%>Illinois</option>
    	<option %%SELECTED:in_ship1_orig_state:Indiana%%>Indiana</option>
    	<option %%SELECTED:in_ship1_orig_state:Iowa%%>Iowa</option>
    	<option %%SELECTED:in_ship1_orig_state:Kansas%%>Kansas</option>
    	<option %%SELECTED:in_ship1_orig_state:Kentucky%%>Kentucky</option>
    	<option %%SELECTED:in_ship1_orig_state:Louisiana%%>Louisiana</option>
    	<option %%SELECTED:in_ship1_orig_state:Maine%%>Maine</option>
    	<option %%SELECTED:in_ship1_orig_state:Maryland%%>Maryland</option>
    	<option %%SELECTED:in_ship1_orig_state:Massachusetts%%>Massachusetts</option>
    	<option %%SELECTED:in_ship1_orig_state:Michigan%%>Michigan</option>
    	<option %%SELECTED:in_ship1_orig_state:Minnesota%%>Minnesota</option>
    	<option %%SELECTED:in_ship1_orig_state:Mississippi%%>Mississippi</option>
    	<option %%SELECTED:in_ship1_orig_state:Missouri%%>Missouri</option>
    	<option %%SELECTED:in_ship1_orig_state:Montana%%>Montana</option>
    	<option %%SELECTED:in_ship1_orig_state:Nebraska%%>Nebraska</option>
    	<option %%SELECTED:in_ship1_orig_state:Nevada%%>Nevada</option>
    	<option %%SELECTED:in_ship1_orig_state:New Hampshire%%>New Hampshire</option>
    	<option %%SELECTED:in_ship1_orig_state:New Jersey%%>New Jersey</option>
    	<option %%SELECTED:in_ship1_orig_state:New Mexico%%>New Mexico</option>
    	<option %%SELECTED:in_ship1_orig_state:New York%%>New York</option>
    	<option %%SELECTED:in_ship1_orig_state:North Carolina%%>North Carolina</option>
    	<option %%SELECTED:in_ship1_orig_state:North Dakota%%>North Dakota</option>
    	<option %%SELECTED:in_ship1_orig_state:Ohio%%>Ohio</option>
    	<option %%SELECTED:in_ship1_orig_state:Oklahoma%%>Oklahoma</option>
    	<option %%SELECTED:in_ship1_orig_state:Oregon%%>Oregon</option>
    	<option %%SELECTED:in_ship1_orig_state:Pennsylvania%%>Pennsylvania</option>
    	<option %%SELECTED:in_ship1_orig_state:Rhode Island%%>Rhode Island</option>
    	<option %%SELECTED:in_ship1_orig_state:South Carolina%%>South Carolina</option>
    	<option %%SELECTED:in_ship1_orig_state:South Dakota%%>South Dakota</option>
    	<option %%SELECTED:in_ship1_orig_state:Tennessee%%>Tennessee</option>
    	<option %%SELECTED:in_ship1_orig_state:Texas%%>Texas</option>
    	<option %%SELECTED:in_ship1_orig_state:Utah%%>Utah</option>
    	<option %%SELECTED:in_ship1_orig_state:Vermont%%>Vermont</option>
    	<option %%SELECTED:in_ship1_orig_state:Virginia%%>Virginia</option>
    	<option %%SELECTED:in_ship1_orig_state:Washington%%>Washington</option>
    	<option %%SELECTED:in_ship1_orig_state:West Virginia%%>West Virginia</option>
    	<option %%SELECTED:in_ship1_orig_state:Wisconsin%%>Wisconsin</option>
    	<option %%SELECTED:in_ship1_orig_state:Wyoming%%>Wyoming</option>
    	<option %%SELECTED:in_ship1_orig_state:Alberta%%>Alberta</option>
    	<option %%SELECTED:in_ship1_orig_state:British Columbia%%>British Columbia</option>
    	<option %%SELECTED:in_ship1_orig_state:Manitoba%%>Manitoba</option>
    	<option %%SELECTED:in_ship1_orig_state:New Brunswick%%>New Brunswick</option>
    	<option %%SELECTED:in_ship1_orig_state:Newfoundland%%>Newfoundland</option>
    	<option %%SELECTED:in_ship1_orig_state:Northwest Territories%%>Northwest Territories</option>
    	<option %%SELECTED:in_ship1_orig_state:Nova Scotia%%>Nova Scotia</option>
    	<option %%SELECTED:in_ship1_orig_state:Nunavut%%>Nunavut</option>
    	<option %%SELECTED:in_ship1_orig_state:Ontario%%>Ontario</option>
    	<option %%SELECTED:in_ship1_orig_state:Prince Edward Island%%>Prince Edward Island</option>
    	<option %%SELECTED:in_ship1_orig_state:Quebec%%>Quebec</option>
    	<option %%SELECTED:in_ship1_orig_state:Saskatchewan%%>Saskatchewan</option>
    	<option %%SELECTED:in_ship1_orig_state:Yukon%%>Yukon</option>
    
     	</select>
       </td>
    <td><font size=“2” face="Georgia" color="green">Origination ZipCode</td>
       <td>
       <input type='text' size='10' name='in_ship1_orig_zip'>
       </td>
      </tr>
    <tr>
       
      
    
      
       <td><font size=“2” face="Georgia" color="green">Destination State</td>
       <td valign=left>
    			<select name=in_ship1_dest_state multiple size=5>
    			
    <option %%SELECTED:'in_ship1_dest_state':%%></option>
            <option %%SELECTED:'in_ship1_dest_state':Alabama%%>Alabama</option>
    	<option %%SELECTED:in_ship1_dest_state:Alaska%%>Alaska</option>
    	<option %%SELECTED:in_ship1_dest_state:Arizona%%>Arizona</option>
    	<option %%SELECTED:in_ship1_dest_state:Arkansas%%>Arkansas</option>
    	<option %%SELECTED:in_ship1_dest_state:California%%>California</option>
    	<option %%SELECTED:in_ship1_dest_state:Colorado%%>Colorado</option>
    	<option %%SELECTED:in_ship1_dest_state:Connecticut%%>Connecticut</option>
    	<option %%SELECTED:in_ship1_dest_state:District of Columbia%%>District of Columbia</option>
    	<option %%SELECTED:in_ship1_dest_state:Delaware%%>Delaware</option>
    	<option %%SELECTED:in_ship1_dest_state:Florida%%>Florida</option>
    	<option %%SELECTED:in_ship1_dest_state:Georgia%%>Georgia</option>
    	<option %%SELECTED:in_ship1_dest_state:Hawaii%%>Hawaii</option>
    	<option %%SELECTED:in_ship1_dest_state:Idaho%%>Idaho</option>
    	<option %%SELECTED:in_ship1_dest_state:Illinois%%>Illinois</option>
    	<option %%SELECTED:in_ship1_dest_state:Indiana%%>Indiana</option>
    	<option %%SELECTED:in_ship1_dest_state:Iowa%%>Iowa</option>
    	<option %%SELECTED:in_ship1_dest_state:Kansas%%>Kansas</option>
    	<option %%SELECTED:in_ship1_dest_state:Kentucky%%>Kentucky</option>
    	<option %%SELECTED:in_ship1_dest_state:Louisiana%%>Louisiana</option>
    	<option %%SELECTED:in_ship1_dest_state:Maine%%>Maine</option>
    	<option %%SELECTED:in_ship1_dest_state:Maryland%%>Maryland</option>
    	<option %%SELECTED:in_ship1_dest_state:Massachusetts%%>Massachusetts</option>
    	<option %%SELECTED:in_ship1_dest_state:Michigan%%>Michigan</option>
    	<option %%SELECTED:in_ship1_dest_state:Minnesota%%>Minnesota</option>
    	<option %%SELECTED:in_ship1_dest_state:Mississippi%%>Mississippi</option>
    	<option %%SELECTED:in_ship1_dest_state:Missouri%%>Missouri</option>
    	<option %%SELECTED:in_ship1_dest_state:Montana%%>Montana</option>
    	<option %%SELECTED:in_ship1_dest_state:Nebraska%%>Nebraska</option>
    	<option %%SELECTED:in_ship1_dest_state:Nevada%%>Nevada</option>
    	<option %%SELECTED:in_ship1_dest_state:New Hampshire%%>New Hampshire</option>
    	<option %%SELECTED:in_ship1_dest_state:New Jersey%%>New Jersey</option>
    	<option %%SELECTED:in_ship1_dest_state:New Mexico%%>New Mexico</option>
    	<option %%SELECTED:in_ship1_dest_state:New York%%>New York</option>
    	<option %%SELECTED:in_ship1_dest_state:North Carolina%%>North Carolina</option>
    	<option %%SELECTED:in_ship1_dest_state:North Dakota%%>North Dakota</option>
    	<option %%SELECTED:in_ship1_dest_state:Ohio%%>Ohio</option>
    	<option %%SELECTED:in_ship1_dest_state:Oklahoma%%>Oklahoma</option>
    	<option %%SELECTED:in_ship1_dest_state:Oregon%%>Oregon</option>
    	<option %%SELECTED:in_ship1_dest_state:Pennsylvania%%>Pennsylvania</option>
    	<option %%SELECTED:in_ship1_dest_state:Rhode Island%%>Rhode Island</option>
    	<option %%SELECTED:in_ship1_dest_state:South Carolina%%>South Carolina</option>
    	<option %%SELECTED:in_ship1_dest_state:South Dakota%%>South Dakota</option>
    	<option %%SELECTED:in_ship1_dest_state:Tennessee%%>Tennessee</option>
    	<option %%SELECTED:in_ship1_dest_state:Texas%%>Texas</option>
    	<option %%SELECTED:in_ship1_dest_state:Utah%%>Utah</option>
    	<option %%SELECTED:in_ship1_dest_state:Vermont%%>Vermont</option>
    	<option %%SELECTED:in_ship1_dest_state:Virginia%%>Virginia</option>
    	<option %%SELECTED:in_ship1_dest_state:Washington%%>Washington</option>
    	<option %%SELECTED:in_ship1_dest_state:West Virginia%%>West Virginia</option>
    	<option %%SELECTED:in_ship1_dest_state:Wisconsin%%>Wisconsin</option>
    	<option %%SELECTED:in_ship1_dest_state:Wyoming%%>Wyoming</option>
    	<option %%SELECTED:in_ship1_dest_state:Alberta%%>Alberta</option>
    	<option %%SELECTED:in_ship1_dest_state:British Columbia%%>British Columbia</option>
    	<option %%SELECTED:in_ship1_dest_state:Manitoba%%>Manitoba</option>
    	<option %%SELECTED:in_ship1_dest_state:New Brunswick%%>New Brunswick</option>
    	<option %%SELECTED:in_ship1_dest_state:Newfoundland%%>Newfoundland</option>
    	<option %%SELECTED:in_ship1_dest_state:Northwest Territories%%>Northwest Territories</option>
    	<option %%SELECTED:in_ship1_dest_state:Nova Scotia%%>Nova Scotia</option>
    	<option %%SELECTED:in_ship1_dest_state:Nunavut%%>Nunavut</option>
    	<option %%SELECTED:in_ship1_dest_state:Ontario%%>Ontario</option>
    	<option %%SELECTED:in_ship1_dest_state:Prince Edward Island%%>Prince Edward Island</option>
    	<option %%SELECTED:in_ship1_dest_state:Quebec%%>Quebec</option>
    	<option %%SELECTED:in_ship1_dest_state:Saskatchewan%%>Saskatchewan</option>
    	<option %%SELECTED:in_ship1_dest_state:Yukon%%>Yukon</option>
     	</select>
       </td>
    <td><font size=“2” face="Georgia" color="green">Destination ZipCode</td>
       <td>
       <input type=text size=10 name=in_ship1_dest_zip>
       </td>
      </tr>
      
      <tr>
       <td><font size=“2” face="Georgia" color="green">Price Per Mile</td>
       <td>
       <input type=text size=4 name=in_ship1_ppm>
       </td>
      </tr>
      <tr>
       <td><font size=“2” face="Georgia" color="green">Payment Method</td>
       <td>
    <select name=in_ship1_pay_method >
    <option%%SELECTED:in_ship1_pay_method:%%></option>
    	<option %%SELECTED:in_ship1_pay_method:Comchek%%>Comchek</option>
    <option %%SELECTED:in_ship1_pay_method:Quick Pay%%>Quick Pay</option>
    	</select>
        </td>
      </tr>
      <tr>
       <td><font size=“2” face="Georgia" color="green">Trailer Type</td>
       <td>
       <select name=in_ship1_trailer_type >
    <option %%SELECTED:in_ship1_trailer_type:%%></option>
    	<option %%SELECTED:in_ship1_trailer_type:Open%%>Open</option>
    <option %%SELECTED:in_ship1_trailer_type:Enclosed%%>Enclosed</option>
    	</select>	
       </td>
      
       <td><font size=“2” face="Georgia" color="green">Number Of Vehicles</td>
       <td>
        <select name=in_ship1_qty >
    	<option %%SELECTED:in_ship1_qty:%%></option>
    <option %%SELECTED:in_ship1_qty:1%%>1</option>
    <option %%SELECTED:in_ship1_qty:2%%>2</option>
    <option %%SELECTED:in_ship1_qty:3%%>3</option>
    <option %%SELECTED:in_ship1_qty:4%%>4</option>
    <option %%SELECTED:in_ship1_qty:5%%>5</option>
    <option %%SELECTED:in_ship1_qty:6%%>6</option>
    <option %%SELECTED:in_ship1_qty:7%%>7</option>
    <option %%SELECTED:in_ship1_qty:8%%>8</option>
    <option %%SELECTED:in_ship1_qty:9%%>9</option>
    <option %%SELECTED:in_ship1_qty:10%%>10</option>
    <option %%SELECTED:in_ship1_qty:11%%>11</option>
    <option %%SELECTED:in_ship1_qty:12%%>12</option>
    <option %%SELECTED:in_ship1_qty:13%%>13</option>
    <option %%SELECTED:in_ship1_qty:14%%>14</option>
    	</select>	
       </td>
       
      </tr><br>
      <tr>
       <td><font size=“2” face="Georgia" color="green">Price To Pay Carrier</td>
       <td>
       <input type=text size=6 name=in_ship1_pay_carrier>
       </td>
      </tr>
      <tr>
       <td><font size=“2” face="Georgia" color="green">Vehicle Type</td>
       <td>
       <select name=in_ship1_vehicle_type>
    	<option></option>
    	<option>Boat</option>
    	<option>Car</option>
    	<option>Motorcycle</option>
    	<option>RV</option>
    	<option>Truck</option>
    	<option>SUV</option>
    	<option>Trailer</option>
    	<option>Van</option>
    	<option>Other</option>
    </select>
       </td>
      </tr>
    <tr>
    <td><font size=“2” face="Georgia" color="green">in-ops OK</td>
    <td><select name=ship1_operable>
    	<option></option>
    	<option>Yes</option>
    	<option>No</option>
    </select>
    </td>
    </tr>
    <tr>
       <td><font size=“2” face="Georgia" color="green">Ship By Date</td>
       <td>
       <script language="javascript" type="text/javascript" src="images/datetimepicker.js"></script>
    <input type=text size=20 name=in_ship1_date_ship id="ship1_date_ship"> <a href="javascript:NewCal('ship1_date_ship','mmddyyyy')"><img src="images/cal.gif" width="16" height="16"  border="0" alt="Pick a date">
       </td>
      </tr>
    
     <tr><td></td><td><input type=submit name=submit value=Search  onclick="verify();">
    
    <input type=reset value="Clear Form"><br></td></tr>
     </table>
    </form>
    
    %%PERL: @$orig= $_GET['ship1_orig_state'];%%
    %%PERL: if( is_array($orig)){%%
    %%PERL: while (list ($key, $val) = each ($orig)) {%%
    %%PERL: echo "$val <br>";%%
    %%PERL: }%%
    %%PERL: }//else{echo "not array";}%%
    
    
    </font>
    </td>       
    </tr>
    </tbody>
    </table>
    </BODY>
    
    
    
    %%TEMPLATE:footer%%

  • #15
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,872
    Thanks
    2
    Thanked 164 Times in 159 Posts
    The problem you want to solve needs to be broken down to at least 2 questions.

    1) What would the the sql syntax to query the db selecting only records that were inserted within the last 4 days?

    The answer here will depend on the db schema, specifically how are the dates/times stored. We can work with you on that, but the MySQL topic area would be a better place to ash that question.

    2) How would I preform that query in this script.

    The script you posted looks like a custom template written by the person that designed your site. That template would need to be parsed by some other script.

    For example, this section is PHP code.
    Code:
    %%PERL: @$orig= $_GET['ship1_orig_state'];%%
    %%PERL: if( is_array($orig)){%%
    %%PERL: while (list ($key, $val) = each ($orig)) {%%
    %%PERL: echo "$val <br>";%%
    %%PERL: }%%
    %%PERL: }//else{echo "not array";}%%
    Once the template tags are removed, would translate to:
    Code:
    $orig = $_GET['ship1_orig_state'];
    if( is_array($orig)){
        while (list ($key, $val) = each ($orig)) {
             echo "$val <br>";
        }
    }//else{echo "not array";}
    Since there is no Perl code in that script, there's little or nothing that we can do to help.

    Once you get the SQL query statement worked out, you'd probably want to post a question in the PHP topic area to see if they can help you add it to your acript.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •