Weird query results / <title> issues

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • guitarromantic@gmail.com

    Weird query results / <title> issues

    Hey everyone.

    I'm editing some stuff I did last summer, trying to bugfix and improve
    stuff. One improvement (or an oversight of the original design) is
    adding dynamic <title> tags to my pages. Here's how I originally
    structured my php pages:

    include header.php (contents are basically my HTML/CSS up to the
    <!--begin content--> point)
    <php code>
    include footer.php (contents are from <!--end content--> onwards).

    Obviously this meant I had the same <title> as defined in header.php
    for every page, not cool. I went through and revised the structure to
    this:

    include doctype.php (HTML from the opening document declaration down to
    just before <title>)
    Then began my query(s), and once the results were grabbed:
    echo "<title>$bandNa me - recordName review</title";
    include header.php (this file now contains everything below <title>
    down to <!--begin content-->)
    <php code to output content>
    include footer.php (as above)

    This worked great for almost all of my pages but one. Here's the link:



    This might look normal to you, but try clicking some of the other
    reviews in the left panel. The cover image and headings stay the same,
    and the author information at the bottom again stays the same, which is
    of course incorrect. I'm not sure where I'm going wrong with my code,
    so I'll post up what I'm doing:



    That file has doctype.php, header.php and footer.php physically
    included so you can see their contents too (ordinarily they're included
    with php includes).

    Any advice as to why I can't get this to work/ how terrible my code
    structuring is would be really helpful.

    Matt

  • guitarromantic@gmail.com

    #2
    Re: Weird query results / &lt;title&gt ; issues

    Anyone?

    Comment

    • Steve

      #3
      Re: Weird query results / &lt;title&gt ; issues

      [color=blue]
      > This might look normal to you, but try clicking some of the other
      > reviews in the left panel. The cover image and headings stay the same,
      > and the author information at the bottom again stays the same, which is
      > of course incorrect. I'm not sure where I'm going wrong with my code,
      > so I'll post up what I'm doing:
      >
      > http://www.threechords.org/spb/revie...layreview.phps[/color]

      I see this:

      mysql_query($q2 ) or die;

      but before that line I don't see any connection code. Maybe there
      should be some connection code?

      ---
      Steve

      Comment

      • guitarromantic@gmail.com

        #4
        Re: Weird query results / &lt;title&gt ; issues

        Ah, I removed my included config.php and opendb.php just for security
        purposes so my password/hostname etc weren't posted up here, should
        have specified.

        Comment

        • Jerry Stuckle

          #5
          Re: Weird query results / &lt;title&gt ; issues

          guitarromantic@ gmail.com wrote:[color=blue]
          > Hey everyone.
          >
          > I'm editing some stuff I did last summer, trying to bugfix and improve
          > stuff. One improvement (or an oversight of the original design) is
          > adding dynamic <title> tags to my pages. Here's how I originally
          > structured my php pages:
          >
          > include header.php (contents are basically my HTML/CSS up to the
          > <!--begin content--> point)
          > <php code>
          > include footer.php (contents are from <!--end content--> onwards).
          >
          > Obviously this meant I had the same <title> as defined in header.php
          > for every page, not cool. I went through and revised the structure to
          > this:
          >
          > include doctype.php (HTML from the opening document declaration down to
          > just before <title>)
          > Then began my query(s), and once the results were grabbed:
          > echo "<title>$bandNa me - recordName review</title";
          > include header.php (this file now contains everything below <title>
          > down to <!--begin content-->)
          > <php code to output content>
          > include footer.php (as above)
          >
          > This worked great for almost all of my pages but one. Here's the link:
          >
          > http://www.threechords.org/spb/reviews/678
          >
          > This might look normal to you, but try clicking some of the other
          > reviews in the left panel. The cover image and headings stay the same,
          > and the author information at the bottom again stays the same, which is
          > of course incorrect. I'm not sure where I'm going wrong with my code,
          > so I'll post up what I'm doing:
          >
          > http://www.threechords.org/spb/revie...layreview.phps
          >
          > That file has doctype.php, header.php and footer.php physically
          > included so you can see their contents too (ordinarily they're included
          > with php includes).
          >
          > Any advice as to why I can't get this to work/ how terrible my code
          > structuring is would be really helpful.
          >
          > Matt
          >[/color]

          Did you dump your database and check it? What's actually in the
          'Cover_Image' column for the row with id 679, for instance?

          It might help as a debugging aid to echo the results returned by your query.


          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • guitarromantic@gmail.com

            #6
            Re: Weird query results / &lt;title&gt ; issues

            Yeah, I know for a fact that row #679 is definitely not holding all of
            the data being displayed there. SOME of it is, just not certain fields,
            they stay the same no matter what the ID.

            Comment

            • Jerry Stuckle

              #7
              Re: Weird query results / &lt;title&gt ; issues

              guitarromantic@ gmail.com wrote:[color=blue]
              > Yeah, I know for a fact that row #679 is definitely not holding all of
              > the data being displayed there. SOME of it is, just not certain fields,
              > they stay the same no matter what the ID.
              >[/color]

              Again, what is there?

              Also, please quote what you're replying to. Not everyone has access to
              previous messages.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • guitarromantic@gmail.com

                #8
                Re: Weird query results / &lt;title&gt ; issues

                Jerry Stuckle wrote:
                [color=blue]
                > Again, what is there?
                >
                > Also, please quote what you're replying to. Not everyone has access to
                > previous messages.[/color]

                Apologies for that.

                Well, we can compare the dev site with the live one:

                Live: http://www.scenepointblank.com/reviews/679

                Dev: http://www.threechords.org/spb/reviews/679

                Try changing the numbers in the URLs: the image, band name, record and
                review name are all messed up. Both sites use the same database (the
                dev site is a duplicate of the live one).

                Comment

                • Steve

                  #9
                  Re: Weird query results / &lt;title&gt ; issues

                  [color=blue]
                  > This might look normal to you, but try clicking some of the other
                  > reviews in the left panel. The cover image and headings stay the same,
                  > and the author information at the bottom again stays the same, which is
                  > of course incorrect. I'm not sure where I'm going wrong with my code,
                  > so I'll post up what I'm doing:[/color]
                  [color=blue]
                  > http://www.threechords.org/spb/revie...layreview.phps[/color]
                  [color=blue]
                  > That file has doctype.php, header.php and footer.php physically
                  > included so you can see their contents too (ordinarily they're included
                  > with php includes).[/color]

                  It occurs to me that you must be using Apache's modrewrite to map fancy
                  URLs to your script displayreview.p hp?id=xyz - is it set up identically
                  for live and dev?

                  ---
                  Steve

                  Comment

                  • guitarromantic@gmail.com

                    #10
                    Re: Weird query results / &lt;title&gt ; issues


                    Steve wrote:[color=blue]
                    > It occurs to me that you must be using Apache's modrewrite to map fancy
                    > URLs to your script displayreview.p hp?id=xyz - is it set up identically
                    > for live and dev?[/color]

                    Yeah - the dev site is an exact replica of the live one, only with URLs
                    changed etc for functionality. You can use URLs of that form you
                    specified with this system, I've tried both and it makes no difference.

                    Comment

                    • joe

                      #11
                      Re: Weird query results / &lt;title&gt ; issues

                      > $author = mysql_query("SE LECT Staff_id, displayname, email FROM users WHERE Staff_id='$Revi ewer_Name'");

                      Is Staff_id an integer and Reviewer_Name something else, e.g. varchar?
                      Seems like you would want to compare displayname with Reviewer_Name (I
                      could be wrong here obviously).

                      One thing that's odd is that the tite is correctly holding the
                      Record_Name value, but later in the script it gets lost somehow....

                      Comment

                      • joe

                        #12
                        Re: Weird query results / &lt;title&gt ; issues

                        Do those other includes (latestreviews. php, latestreviews2. php) have
                        variables with the same name as those in displayreview.p hp (like
                        $Band_Name, Cover_Image)?

                        This may be stating the obvious but from what I could tell, the
                        variables getting lost/displaying incorrect info are Band_Name,
                        Record_Name, Cover_Image, and displayname. The rest seem to be coming
                        through ok, since the text of the review changes appropriately, as does
                        the score, the link to the band's site, etc.

                        Comment

                        • guitarromantic@gmail.com

                          #13
                          Re: Weird query results / &lt;title&gt ; issues


                          joe wrote:[color=blue][color=green]
                          > > $author = mysql_query("SE LECT Staff_id, displayname, email FROM users WHERE Staff_id='$Revi ewer_Name'");[/color]
                          >
                          > Is Staff_id an integer and Reviewer_Name something else, e.g. varchar?
                          > Seems like you would want to compare displayname with Reviewer_Name (I
                          > could be wrong here obviously).
                          >
                          > One thing that's odd is that the tite is correctly holding the
                          > Record_Name value, but later in the script it gets lost somehow....[/color]

                          Despite the names, Reviewer_Name is an integer as well. I changed the
                          db structure around and was too lazy to change it to something more
                          meaningful (and thus all the references to it elsewhere).. I suck,
                          haha.

                          Yeah, see what I mean? It's a weird error.


                          joe wrote:[color=blue]
                          > Do those other includes (latestreviews. php, latestreviews2. php) have
                          > variables with the same name as those in displayreview.p hp (like
                          > $Band_Name, Cover_Image)?[/color]

                          Yeah they do, I'll try removing the includes for those files and see
                          what happens.

                          Comment

                          • Jerry Stuckle

                            #14
                            Re: Weird query results / &lt;title&gt ; issues

                            guitarromantic@ gmail.com wrote:[color=blue]
                            > Jerry Stuckle wrote:
                            >
                            >[color=green]
                            >>Again, what is there?
                            >>
                            >>Also, please quote what you're replying to. Not everyone has access to
                            >>previous messages.[/color]
                            >
                            >
                            > Apologies for that.
                            >
                            > Well, we can compare the dev site with the live one:
                            >
                            > Live: http://www.scenepointblank.com/reviews/679
                            >
                            > Dev: http://www.threechords.org/spb/reviews/679
                            >
                            > Try changing the numbers in the URLs: the image, band name, record and
                            > review name are all messed up. Both sites use the same database (the
                            > dev site is a duplicate of the live one).
                            >[/color]

                            Again - are you sure you don't have a corrupted database?

                            Did you try echoing the values you retrieved from the database like I
                            suggested?

                            Sometimes an echo here and there does wonders for debugging!


                            --
                            =============== ===
                            Remove the "x" from my email address
                            Jerry Stuckle
                            JDS Computer Training Corp.
                            jstucklex@attgl obal.net
                            =============== ===

                            Comment

                            Working...