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 12 of 12

Thread: No second page

  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts

    No second page

    Can someone figure out how this guy does this:

    http://epw.e-wrestling.org/titlehistories.php

    I mean how when you click on a title it doesn't have to go to another page but just brings up that titles info. I'm trying to but the only way it seems to like I have to have it have a second page.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    It passes the data back to itself and extracts the id from the $_GET. It can be seen in the url for it.
    PHP Code:
    <?php

    if (isset($_GET['id']))
    {
        
    // Do stuff to show an individual record
    }
    else
    {
        
    // do stuff to show all records
    }
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    Does this look right?

    PHP Code:
    <?php

    // Connects to your Database
    $link mysql_connect("?""?""?") or die(mysql_error());
    mysql_select_db("?",$link) or die(mysql_error());
     
    if (!
    mysql_select_db("?"$link)) {
    echo 
    'Could not select database';
    exit;
    }

    if (isset(
    $_GET['id']))
    {
        
    // Do stuff to show an individual record
    }
    else
    {
        
    // do stuff to show all records
    }



    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;<font color="white">Title Histories</font></td></tr>';
    print 
    '</table>';
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar3.gif" height=35 colspan=4>&nbsp;Active Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Active'"// Active rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>';
    print 
    '<img src=images/spacer.gif><br>';
    print 
    '<table border=0 cellspacing=0 cellpadding=3 width=575><tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Inactive Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Inactive'"// Inactive Rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>'
    ?>

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Yes and no. The code looks ok, but the logic is off. What you have posted appears to be the All records stuff that would go into the else block. You need to program the if block for if id is provided. Change the query inside the new if block to use a where on the provided id to fetch just the one record you want.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    I must apologize buddy I'm having a hard time understanding what you are saying.

    Quote Originally Posted by Fou-Lu View Post
    Yes and no. The code looks ok, but the logic is off. What you have posted appears to be the All records stuff that would go into the else block. You need to program the if block for if id is provided. Change the query inside the new if block to use a where on the provided id to fetch just the one record you want.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    All of this:
    PHP Code:
    print '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;<font color="white">Title Histories</font></td></tr>';
    print 
    '</table>';
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar3.gif" height=35 colspan=4>&nbsp;Active Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Active'"// Active rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>';
    print 
    '<img src=images/spacer.gif><br>';
    print 
    '<table border=0 cellspacing=0 cellpadding=3 width=575><tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Inactive Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Inactive'"// Inactive Rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>'
    Appears to belong in the else part of the if / else call. You need to rewrite code to place into the if section to show the individual information:
    PHP Code:
    if (isset($_GET['id']))
    {
        
    // Do you're stuff for a specific record here
    }
    else
    {
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;<font color="white">Title Histories</font></td></tr>';
    print 
    '</table>';
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar3.gif" height=35 colspan=4>&nbsp;Active Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Active'"// Active rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>';
    print 
    '<img src=images/spacer.gif><br>';
    print 
    '<table border=0 cellspacing=0 cellpadding=3 width=575><tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Inactive Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Inactive'"// Inactive Rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>'

    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    I worked with the code and for some reason I just couldn't get it to do it.

    I'm trying to take a script I saw on one page and add it to my own since it's exactly what I was wanting to do in the first place.

    This is what I'm wanting to happen:

    http://epw.e-wrestling.org/titlehistories.php

  • #8
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    PHP Code:
    if (isset($_GET['id']))
    {
        
    // Do stuff to show an individual record
    }
    else
    {
        
    // do stuff to show all records
        // This section  needs to be your code 
        // that displays the page as normal

    So what you need to do is
    PHP Code:
    if (isset($_GET['id']))
    {
        
    // Do you're stuff for a specific record here
        // This section you would write all the code for the page 
        // that needs to be displayed when "$_GET['id']" is defined
    }
    else
    {
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;<font color="white">Title Histories</font></td></tr>';
    print 
    '</table>';
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar3.gif" height=35 colspan=4>&nbsp;Active Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Active'"// Active rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>';
    print 
    '<img src=images/spacer.gif><br>';
    print 
    '<table border=0 cellspacing=0 cellpadding=3 width=575><tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Inactive Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Inactive'"// Inactive Rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>'


  • #9
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    I'm getting a
    Parse error: parse error, unexpected T_ELSE in /home/content/y/a/n/yankeefaninkc/html/titlehistory5.php on line 36.

    Here's my code:

    PHP Code:
    <?php
    // Connects to your Database
    $link mysql_connect("?""?""?") or die(mysql_error());
    mysql_select_db("?",$link) or die(mysql_error());
     
    if (!
    mysql_select_db("?"$link)) {
    echo 
    'Could not select database';
    exit;
    }

    if (isset(
    $_GET['id']))
    {
    //Define the query
    $query "SELECT *, DATE_FORMAT(`datecreated`, '%M %e, %Y') as datecreated FROM titlehistory";

    if (
    $r mysql_query ($query)){ // Run the query. 
        
    while ($row mysql_fetch_array ($r)){

    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;<font color="white">Title Histories</font></td></tr>';
    print 
    '<tr><td></td></tr>';
    print 
    '</table>';
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar3.gif" height=35 colspan=2><font color=red>&nbsp;KOW '.$row['titlename'].'</font></td></tr>';
    print 
    '<tr><td width=200><img src="/images/' $row['titleimage'] . '" width=208px height=156px border=0 alt="View KOW '.$row['titlename'].' History"></td><td valign=top>';
    print 
    '<table cellpadding="2" cellspacing="0" border="0" width=100%>';
    print 
    '<tr><td align=center bgcolor=#E0E0E0><b>Date Created</b></td></tr><tr><td align=center><font color=white>'.$row['datecreated'].'</font></td></tr>';
    print 
    '<tr><td bgcolor=#E0E0E0 align=center><b>Status</b></td></tr>';
    print 
    '<tr><td align=center><font color=white>'.$row['status'].'</font></td></tr>';
    print 
    '<tr><td bgcolor=#E0E0E0 align=center><b>Longest Reign</b></td></tr>';
    print 
    '<tr><td align=center><a href=bio.php?'.$row['longestreign'].'><b>'.$row['longestreign'].'</b></a> <font color=white>('.$row['numdays'].')</font></td></tr>';
    print 
    '<tr><td bgcolor=#E0E0E0 align=center><b>Most Successful Defenses</b></td></tr>';
    print 
    '<tr><td align=center><a href=bio.php?'.$row['sucessdefenses'].'><b>'.$row['sucessdefenses'].'</b></a> <font color=white>('.$row['numdef'].')</font></td></tr>';
    print 
    '</table>';
    }
    else
    {
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;<font color="white">Title Histories</font></td></tr>';
    print 
    '</table>';
    print 
    '<table border=0 cellspacing="0" cellpadding=3 width=575>';
    print 
    '<tr><td background="images/bg_bar3.gif" height=35 colspan=4>&nbsp;Active Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Active'"// Active rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>';
    print 
    '<img src=images/spacer.gif><br>';
    print 
    '<table border=0 cellspacing=0 cellpadding=3 width=575><tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Inactive Titles</td></tr>';
    print 
    '<tr>';

    //Define the query
    $query "SELECT * FROM titles WHERE status = 'Inactive'"// Inactive Rows

    if ($r mysql_query ($query)){ // Run the query. 

        
    while ($row mysql_fetch_array ($r)){
        
            print 
    '<td><a href="titlehistory.php?id=' $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
            print 
    '<img src="/images/' $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a></td>';
        
        }

    } else {
        die (
    '<p>Could not retrieve the data because <b>' mysql_error() . '</b>. The query was $query.</p>');
    //End of query IF 

    print '</tr>';
    print 
    '</table>'
    }  
    ?>

  • #10
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    You're missing a curly brace right here
    PHP Code:
    }
    else

    so it needs to be
    PHP Code:
    }
    }
    else


  • #11
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    I get of one error and I get another.

    Parse error: parse error, unexpected $ in /home/content/y/a/n/yankeefaninkc/html/titlehistory5.php on line 88

  • #12
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    Nevermind I got that fixed. However when I go to my http://www.kansasoutlawwrestling.com/titlehistory.php page and click on the first title it won't go to the post the info for the title.


  •  

    Posting Permissions

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