1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

PHP Help

Discussion in 'BBS Hangout' started by Lil Pun, Apr 20, 2011.

  1. SwoLy-D

    SwoLy-D Contributing Member

    Joined:
    Jul 20, 2001
    Messages:
    37,617
    Likes Received:
    1,448
    :(

    ^ You'll end up going back to your code to always change your "IF" to match something available. FAIL. :eek:
     
  2. Kyakko

    Kyakko Contributing Member

    Joined:
    Aug 15, 2002
    Messages:
    2,161
    Likes Received:
    39
    I think what Mr. Emoticon is trying to say is to get the date values from the system using something like the date("Y") function to set the drop down, after concatenating it with the semester code, i.e.

    $dropDownOpt="SU" . date("Y");

    Then comparing it with values from table values. That way you won't have to change the code every year.
     
  3. madmonkey37

    madmonkey37 Contributing Member

    Joined:
    Jun 20, 2003
    Messages:
    2,499
    Likes Received:
    52
    True, but it'll only take 10 seconds and he'll only have to do it every 4 months. A quick and easy solution will cost him 30 seconds a year. And, I'm pretty sure theres a way to make the if statements dynamic using date functions.
     
  4. Lil Pun

    Lil Pun Contributing Member

    Joined:
    Oct 6, 1999
    Messages:
    34,132
    Likes Received:
    1,021
    This is my thinking. It seems the easiest way to do it right now and then I can delve further into it in the future.
     
  5. SwoLy-D

    SwoLy-D Contributing Member

    Joined:
    Jul 20, 2001
    Messages:
    37,617
    Likes Received:
    1,448
    No, not "date functions". Make a table of only available semester codes and search that one to give them the choice... and then... WAIT A MINUTE, I already explained that before... :eek:

    NO.

    But, yea, if you want to be Lil Lazy and not work your mind into it now and not have to fix it later, go ahead and HARD-CODE them. :p It's not efficient, but it's the easy way out.

    FURTHER EXPLANATION:
    Let's say you enter a bunch of records... where all these students attended in semester with code SU2011. OK, so you put "SU2011" on your IF statement. You enter a bunch MORE records. Now you have to go and edit your PHP to hard code "SU2011", "SU2010", "FA2010", etc. What if you get more records? Ooops, with your "if this and if that" solution, you have to (yet again) edit your PHP to include an if statement that's BIGGER than the original that's what she said IF statement. ¿Comprende?

    With a dynamically built drop-down menu that gathers only the available ones, you get to check everyone's available, then check to see if that person has one graduation request in that semester. Done.
     
    #45 SwoLy-D, Jun 1, 2011
    Last edited: Jun 1, 2011
  6. Pull_Up_3

    Pull_Up_3 Member

    Joined:
    Jan 8, 2010
    Messages:
    6,089
    Likes Received:
    306
    hello as you can see cf something something, kyakko


    wat
     
  7. Kyakko

    Kyakko Contributing Member

    Joined:
    Aug 15, 2002
    Messages:
    2,161
    Likes Received:
    39
    I get what you're saying. Populate the drop downs with values from the table with something like "select distinct semester from table order by date". Mine will work also without constant updating, except you might get values semesters not in the table. In which case just echo out "no records found". :p
     
  8. SwoLy-D

    SwoLy-D Contributing Member

    Joined:
    Jul 20, 2001
    Messages:
    37,617
    Likes Received:
    1,448
    ^ Exactly, brother. :cool:

    Who likes "records not found"? No one. So don't even let them choose if there's none for them.

    Another approach is to not let them choose the semester code at all, but only until they've logged in. This way, you save processing time to find out.

    OR, just list the ones they have available without even asking them to click anything. ;)
     
  9. Lil Pun

    Lil Pun Contributing Member

    Joined:
    Oct 6, 1999
    Messages:
    34,132
    Likes Received:
    1,021
    Guys, I am still a novice at coding PHP. I think hard-code is all I really know how to do. Haven't really had time to explore other avenues. Hopefully soon but not yet.....
     
  10. SwoLy-D

    SwoLy-D Contributing Member

    Joined:
    Jul 20, 2001
    Messages:
    37,617
    Likes Received:
    1,448
    ^ If there's one thing I hate, is when someone wants to RUN instead of learning first how to CRAWL, then how to STAND UP, then how to WALK, then how to RUN. I find it difficult to believe that someone can learn so much in so little time, and that real-time problems can be dealt with by people who already know how to RUN... but that the people who are now barely standing up or walking can see how they can get there by RUNning. Meh, it's just my way of saying "make sure you have a good grasp of what you CAN do before you try to do it." That's all.

    I am hoping you completely know HTML before you learn scripting PHP, is what I'm saying.

    We're here to help, yo. :cool: There's many ways to skin a cat... cat.
     
  11. CrazyDave

    CrazyDave Contributing Member

    Joined:
    Nov 21, 2002
    Messages:
    6,027
    Likes Received:
    439
    anyone else getting this kinda stuff in some of the threads here today?

    <a target='_blank' title='ImageShack - Image And Video Hosting' href='http://imageshack.us/photo/my-images/194/picture3qmi.png/'><img src='http://img194.imageshack.us/img194/8823/picture3qmi.png' border='0'/></a>

    Uploaded with <a target='_blank' href='http://imageshack.us'>ImageShack.us</a>
     
  12. Billy Bob

    Billy Bob Member

    Joined:
    Nov 1, 2009
    Messages:
    591
    Likes Received:
    21
    Sorry, that's me. Read post #4. I was pointing out why you should sanitize (or clean your code). Unfortunately, I can't edit it out now.
     
  13. Billy Bob

    Billy Bob Member

    Joined:
    Nov 1, 2009
    Messages:
    591
    Likes Received:
    21
    Oh.. Kyakko is my other nick.
     
  14. Lil Pun

    Lil Pun Contributing Member

    Joined:
    Oct 6, 1999
    Messages:
    34,132
    Likes Received:
    1,021
    Can anybody help me with this section of coding:

    I keep getting the following error:

    Parse error: parse error, unexpected '>' in D:\webroot\registrar.astate.edu\web\gradtrack\index-main.php on line 362

    But when I test my code here: http://writecodeonline.com/php/ it works. EDIT: I added those first two line in the previous website and received the parse error.

    :confused::confused:

    Line 362 is this one:
    HTML:
    echo "<p />The date of commencement is Saturday, May 7, 2011. Commencement will be broken into two ceremonies as shown below.
    HTML:
    {
    		  echo "<hr /><p /><b><div align='left'>Commencement Time and Location</div></b>
    
    			      <p />Your major is in the college of <b>".$myCollegeD.";
    
    
    echo "<p />The date of commencement is Saturday, May 7, 2011. Commencement will be broken into two ceremonies as shown below.
     
    <p><b><u>10:00 AM Ceremony</u></b></p>
    <p>College of Communications </p>
    <p>College of Education </p>
    <p>College of Engineering </p>
    <p>College of Humanities/Social Sciences </p>
    <p>University College </p>
    
    <p><b><u>2:30 PM Ceremony</u></b></p>
    <p>College of Agriculture </p>
    <p>College of Business </p>
    <p>College of Fine Arts </p>
    <p>College of Nursing/Health Professions </p>
    <p>University Science/Mathematics </p>
    <p></p>
    
    <p><b><font color='red'> ***UPDATE*** <a href='http://registrar.astate.edu/convolayoutspring2011.pdf' target='blank'>Click here</a> to see the tentative layout for your college.  This will help your families and friends determine where to sit on your special day!</p></b></font>
    
    Please remember to be at the Convocation Center one hour early to prepare for the procession lineup. <p />Ample parking is available in all areas with special reserved sections. Reserved parking for the disabled is near the yellow entrance. 
     
    
    <p />Disabled and hearing-impaired students should contact Beverly at <a href='mailto:fake@fakeemail.com'>fake@fakeemail.com</a> for special accommodations.<p />Not attending the ceremony? <a href='http://registrar.astate.edu/graduation/trackingyou.php' target='blank'>Let us know.</a>";
     
    #54 Lil Pun, Jun 9, 2011
    Last edited: Jun 9, 2011
  15. Mango

    Mango Contributing Member

    Joined:
    Sep 23, 1999
    Messages:
    7,530
    Likes Received:
    1,959
    HTML Paragraph Tag

    You appear to be doing some <i>alternate</i> things with the Paragraph tag in a few places.
     
  16. Lil Pun

    Lil Pun Contributing Member

    Joined:
    Oct 6, 1999
    Messages:
    34,132
    Likes Received:
    1,021

    Yeah, I figured out the problem. Thanks.
     
  17. SwoLy-D

    SwoLy-D Contributing Member

    Joined:
    Jul 20, 2001
    Messages:
    37,617
    Likes Received:
    1,448
    You should REALLY learn HTML before you learn PHP, man. :cool:
     
  18. Kyakko

    Kyakko Contributing Member

    Joined:
    Aug 15, 2002
    Messages:
    2,161
    Likes Received:
    39
    Swoly-D is right. I recommend you pick up an HTML for Dummies book before you continue much farther. It just takes about a day to learn. HTML is a mark-up language, meaning most of the code is just to define how the webpage looks, color, size, position etc. There's no algorithms involved so it should not be that hard. Then pick up a CSS book since most of the tags you are using have been deprecated.

    It looks a little bad if you're doing this for a college (I work for a university myself). Colleges should (or attempt) to be 508 compliant (accessibility).

    P.S. I think your problem is that the quotes aren't closed off properly. And you need to close off the code section with ?> to tell the server the rest of the code is html and not php.

    Good luck.
     
    #58 Kyakko, Jun 9, 2011
    Last edited: Jun 9, 2011
  19. Lil Pun

    Lil Pun Contributing Member

    Joined:
    Oct 6, 1999
    Messages:
    34,132
    Likes Received:
    1,021
    That was it, I was missing a quotation mark in the code. What's wrong with the HTML?
     
  20. Kyakko

    Kyakko Contributing Member

    Joined:
    Aug 15, 2002
    Messages:
    2,161
    Likes Received:
    39
    The font, b and u tags are "deprecated", meaning you shouldn't use them because they are in the process of being phased out. Future browsers doesn't have to support them, when in compliance with the W3C conventions (the group that standardize html). Use CSS for the fonts and u, and the strong tag instead.
     
    #60 Kyakko, Jun 9, 2011
    Last edited: Jun 9, 2011

Share This Page

  • About ClutchFans

    Since 1996, ClutchFans has been loud and proud covering the Houston Rockets, helping set an industry standard for team fan sites. The forums have been a home for Houston sports fans as well as basketball fanatics around the globe.

  • Support ClutchFans!

    If you find that ClutchFans is a valuable resource for you, please consider becoming a Supporting Member. Supporting Members can upload photos and attachments directly to their posts, customize their user title and more. Gold Supporters see zero ads!


    Upgrade Now