what goes after the ? in links?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

craigwg
Forum Newbie
Posts: 23
Joined: Tue Nov 03, 2009 7:48 pm

Re: what goes after the ? in links?

Post by craigwg »

I GOT IT WORKING!!! It was in deed the apostrophies. Your code had apostrphies but the correct query goes like this:

Code: Select all

 
$query = "
  SELECT id, date_format(date, '%M %e, %Y') as date, title, entry 
  from tblJournal 
  WHERE id = $id 
  ORDER BY id DESC
  LIMIT $start, $display";
 
Notice the where statement has no apostrphies around neither the variable nor the field from the database. Now my permalinks are working! Which means now my RSS feed is more accurate! We are excited about this!!!!!!!!!!

Now I just need to deal with more apostrophies in the actual text of my journal interfering with the RSS feed. Then I think I'm going to attach it to my facebook page, and maybe just maybe, reformat the page so it doesn't look like it came from the 1980s!

Thanks again!
craigwg
Forum Newbie
Posts: 23
Joined: Tue Nov 03, 2009 7:48 pm

Re: what goes after the ? in links?

Post by craigwg »

Oysh,

Yes I did the the ?id=x working. But on further review, it broke everything else.

For example, once I used ?id=x it set the id variable. So when I went to use the pagination on the page, or simply use a link on my nav bar that does NOT use the id variable it panicked.

I tried a few fixes, none with success. I attempted setting the id variable to NULL at the end of the document but that didn't work. I also attempted adjusting the query to display the max ID. Maybe that's the answer - to redo all the links on my site and across the web. I still want to be able to give people my regular webpage as http://www.craiggreenwood.com/journal.php and have it display the most recent entry.

Ug, I'm not even sure what question to ask. What is the standard way of doing this? Everyone has permalinks and my desire isn't anything beyond that.

Craig
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: what goes after the ? in links?

Post by Eric! »

As I mentioned before you need to add error checking for missing values and out of range values.

If the id is not set, maybe you should use your original query string without the where id='$id'. It's up to you how you want your site to respond.

You also need error checking for 's' and 'ns' as well as adding filtering I suggested in my previous post.
Post Reply