By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,703 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,703 IT Pros & Developers. It's quick & easy.

Weird query results / <title> issues

P: n/a
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>$bandName - 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

Feb 18 '06 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Anyone?

Feb 23 '06 #2

P: n/a
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


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

Feb 23 '06 #3

P: n/a
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.

Feb 23 '06 #4

P: n/a
gu************@gmail.com wrote:
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>$bandName - 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


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.
js*******@attglobal.net
==================
Feb 23 '06 #5

P: n/a
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.

Feb 24 '06 #6

P: n/a
gu************@gmail.com wrote:
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.


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.
js*******@attglobal.net
==================
Feb 24 '06 #7

P: n/a
Jerry Stuckle wrote:
Again, what is there?

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


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).

Feb 24 '06 #8

P: n/a
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).


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

---
Steve

Feb 24 '06 #9

P: n/a

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


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.

Feb 24 '06 #10

P: n/a
joe
> $author = mysql_query("SELECT Staff_id, displayname, email FROM users WHERE Staff_id='$Reviewer_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....

Feb 24 '06 #11

P: n/a
joe
Do those other includes (latestreviews.php, latestreviews2.php) have
variables with the same name as those in displayreview.php (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.

Feb 24 '06 #12

P: n/a

joe wrote:
$author = mysql_query("SELECT Staff_id, displayname, email FROM users WHERE Staff_id='$Reviewer_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....


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: Do those other includes (latestreviews.php, latestreviews2.php) have
variables with the same name as those in displayreview.php (like
$Band_Name, Cover_Image)?


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

Feb 25 '06 #13

P: n/a
gu************@gmail.com wrote:
Jerry Stuckle wrote:

Again, what is there?

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

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).


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.
js*******@attglobal.net
==================
Feb 25 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.