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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    84
    Thanks
    49
    Thanked 0 Times in 0 Posts

    dynamic details page pulling from sql table

    I've scoured the web for a tutorial about this, but to no avail. And so I turn to you helpful comrades. Here's what I need to do:

    I have a MySQL database with an Events table. I have already created a PHP web page with a list of the Event titles and some summary info example here: http://www.hedgevent.com, Each event title must be a link to the full details of the Event. But I want to avoid having to create a static page for each event.

    Is there a way to have the event name be added to the end of the url and the data to be pulled to appear in the spaces i have made on my sample details page?

    Code:
    <div id="container">
    	<div id="listing">	
        
        <h2>Activist Investor Conference</h2><br>
    <table width="500" border="0" cellpadding="5">
      <tr>
        <td>Export</td>
        <td>Outlook | Google | Apple iCal | Yahoo | MSN</td>
      </tr>
      <tr>
        <td>Share</td>
        <td>Linkedin | Facebook | Google+ | Twitter | Stocktwits</td>
      </tr>
      <tr>
        <td>Rating</td>
        <td>*****</td>
      </tr>
      <tr>
        <td>Venue</td>
        <td>Waldorf Astoria</td>
      </tr>
      <tr>
        <td>Location</td>
        <td>123 Central Park Lane - New York NY 11298</td>
      </tr>
    
    </table>
    <br>
    <p>Details:</p> <br>
    <p>The Activist Investor Conference is your opportunity to network with the most important group of activist investors, corporate governance specialists, advisory firms, proxy solicitors, and corporate board members. This two-day event features a complete view of activist investment strategies and their impact on corporate performance and returns. The agenda examines topics vital to both investors and corporate boards.
    </p>

  • #2
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Yup. Appending a query string to the URL will send information into the $_GET superglobal. Then, you just pull the event name (or id) and get it from whichever place you've stored the data, most likely a database.

    http://www.w3schools.com/php/php_get.asp

    Although that shows you an example in a form submission context, the form is not necessary; it's the url query string that is important (index.php?something=value&somethingelse=anothervalue).

    If you do end up using mysql, remember to use mysql_real_escape_string to stop mysql injection
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.


  •  

    Posting Permissions

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