Jump to content

gigantorTRON

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gigantorTRON's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks barand!! I must get used to joins!
  2. I have two database tables as follows: Member_ID Member_Name Member_Email License_ID Member_ID License_Name License_Expiration I'm running a query that will pull the member information from the Member table to insert into an e-mail if the member's license expires within 30 days. The issue is that there are some members who have renewed their license before the expiration of their current license. The new license script inserts a new row into the license table with all pertinent information. When I run my query, I need to add a check that will disregard members who have a new license even though they may have a still-active license set to expire within 30 days. Another example: Member_ID Member_Name Member_Email 1Joejoe@hotmail.com License_ID Member_ID License_Name License_Expiration 11Driver's License2008-07-31 21Driver's License2012-07-31 so when I run a query like this: SELECT * FROM Member, License WHERE Member.Member_ID = License.License_ID AND DATEDIFF(License.License_Expiration, CURDATE()) <= 30; I get a record returned to e-mail Joe even though he has a license that's good beyond 30 days. I've tried to get around the issue using COUNT() to find duplicates based on the member_id with no luck. Any ideas??
  3. Yeah. What I'm referring to would be a table that associates PKs between tables. This would allow you to lookup data across tables by first checking the associations table, pulling the needed primary key and then using that to search another table rather than doing multiple joins. I guess it would be handy for complex DB and speed up performance on SELECT queries?
  4. Obviously the answer to this question is heavily dependent upon the situation, but, generally, is it better to create separate tables and use JOIN syntax to join them and pull data, or is it better to use an 'association' table that contains ID associations? Or, is there an even better alternative that I'm not aware of? Thanks!
  5. The interval is the number of days between tests. Some tests have to take place a shorter intervals than others. This should be >=... it's there because it need to be at least 1 month later. What I'm trying to do is a query that will show all 'sites' in my database that are due for inspection. The date that a site is 'due' is the day of the following month of inspection + 1 day. For example: last inspected Jan. 21, it should be due on Feb. 22.
  6. Hey all... I'm trying to pull a date query where an inspection date is compared to the current date and all items due for inspection are displayed. If the inspection date is Dec. 21, then the notification date should be Jan. 22 (there's no consistent day count which makes this harder). Here's the AND statements I have so far, but they don't work right. This is in mySQL 4. AND ((TO_DAYS(CURDATE())-(TO_DAYS(ps.PAD_Sites_Last_Inspected))) > cci.Corp_Customer_Info_CheckAED_Interval) " . "AND DATE_FORMAT(CURDATE(), '%m') > MONTH(ps.PAD_Sites_Last_Inspected) " . "AND CURDATE() > (INTERVAL 1 MONTH + ps.PAD_Sites_Last_Inspected) " . "AND CURDATE() > ps.PAD_Sites_Last_Inspected " . "ORDER BY mCust.Members_ID ASC, mPSC.Members_ID ASC, ps.PAD_Sites_Name ASC"; Is there an easy way to do this right?
  7. I have a snippet of javascript code as defined here: <SCRIPT LANGUAGE="JavaScript"> //create onDomReady Event window.onDomReady = DomReady; //Setup the event function DomReady(fn) { //W3C if(document.addEventListener) { document.addEventListener("DOMContentLoaded", fn, false); } //IE else { document.onreadystatechange = function(){readyState(fn)} } } //IE execute function function readyState(fn) { //dom is ready for interaction if(document.readyState == "completed") { fn(); } } function hideStates(element, name) { if (name =='post_customer_Country') { if (element=='US' || element=='CA') { document.getElementById("state1").innerHTML = '<?php $HTML->print_StatesDorpDownBox("post_customer_State", "", $post_customer_State); ?>' } else { document.getElementById("state1").innerHTML='<input type="text" name="post_customer_State" id="post_customer_State_Text" size="15" maxlength="25" value="<?php print $post_customer_State; ?>">'; } } else { if (element=='US' || element=='CA') { document.getElementById("state2").innerHTML = '<?php $HTML->print_StatesDorpDownBox("post_members_State", "", $post_members_State); ?>' } else { document.getElementById("state2").innerHTML='<input type="text" name="post_members_State" id="post_members_State_Text" size="15" maxlength="25" value="<?php print $post_members_State; ?>">'; } } } function onReady() { hideStates(document.getElementById('post_customer_Country').value, 'post_customer_Country'); hideStates(document.getElementById('post_members_Country').value, 'post_members_Country'); } window.onDomReady(onReady); </script> Basically, this is a edit registration form containing country and state/province/region. If the United States or Canada is selected, a drop down box will appear for state. Otherwise, a text box will be displayed. However, I need the appropriate form element to be displayed upon loading which is what the onReady function is for. This works correctly in Firefox but not IE or Safari. Thanks!
  8. Well... I don't really need it to be that complex. I already have a PHP function to print out the second drop down box. Here's the situation: New registrant must select their country upon registration (Select box 1). If they select the United States or Canada, then Select box 2 populates the US and CA states. Else, a text box is displayed. So I need to dynamically control the type of form element based on what country is selected. Is this possible?? Here's what I have so far (js n00b) function printStates() { var selectedCountry = document.custForm.post_Customer_Country.selectedIndex; if (selectedCountry=='US' || selectedCountry=='CA') { } else { } }
  9. Hey guys. Quick question here... I have two sections of a form that contain dropdown boxes. If a user selects dropdownbox index #1, then I need the 2nd drop down box to populate with certain data. If they select #2, then I need the field to be a text box, not drop down. What's the easiest way to do this? Thanks.
  10. Hello, I'm working with a text file that contains the names of websites and their corresponding URLs in the following fashion: <a href="www.cnn.com">CNN News</a> Each site and title is separated by line breaks. I'm not very experienced with fopen, fread, etc. and was wondering if anyone could give me pointers on how to go about reading the text file line by line and saving the URL and title in separate columns in a database. Oh, and one more thing. The categories of these sites are also included every so often. I was hoping to save the category in a third field. Ex: News (\n new line here) <a href="www.cnn.com">CNN News</a> (\n) <a href="www.bbc.com">BBC News </a> etc. Thanks!
  11. Quick question for yas.. How would I could I go about creating a script to destroy idle sessions after X minutes?? I know that there's a variable in the php.ini file that relates to garbage collection that you can set to different time periods, but I left a session open all night and it was still active when I came back this morning. I'd like to kill sessions that have been idle for 15+ minutes.
  12. Right on man! I can always add a little 'you must have javascript enabled' line... thanks.
  13. Yeah, i was afraid it might be confusing... Basically I need to validate that all the questions have been answered before allowing the user to go to the next page... I suppose I could use javascript but would prefer php in case a user has disabled js in their browser.
×
×
  • 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.