General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 6th, 2003, 01:44 PM
kimy_cool kimy_cool is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 6 kimy_cool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Retrieving URL Parameters

Hi guys,

Am trying to build an online bible search using MySQL & PHP.

Well, when a user clicks on a link like 1Peter 1:3, a pop up browser should open and retrieve the the booktitle,chapter,verse respectively.

My database schema has three columns i.e booktitle, chapter & verse.

Can it be like ../bible?1Peter+1:3?

Kim

Reply With Quote
  #2  
Old April 19th, 2003, 10:44 PM
pentapenguin pentapenguin is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 51 pentapenguin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 7 sec
Reputation Power: 6
The problem is that any non-alphanumeric character (spaces, colons, etc) CAN NOT appear in a URL.

You would need to rewrite the PHP code that displays the link to something like this:

PHP Code:
<?php

print (urlencode("displayverse.php?chapter=$chapter&verse=$verse"));

?>


I hope this helps.

Reply With Quote
  #3  
Old April 20th, 2003, 12:00 PM
kimy_cool kimy_cool is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 6 kimy_cool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool

Thanx penguin.

I tried this

PHP Code:
 bible.php?booktitle=1%20Peter&chapter=02&verse=020 


and it worked. There is no problem with it but what if i want to retrieve a range of verses maybe from John to Mark? My database has booktitle,chapter & verse as the fields e.g

Read John 1:2 - Mark 2:2 what is the PHP function for retrieving such a query?

Hope someone helps

Reply With Quote
  #4  
Old April 22nd, 2003, 12:20 AM
avit avit is offline
Not Yet Perfect
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Squamish, BC
Posts: 111 avit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to avit
That depends on how your database is organized...

If you don't have numerical ID's for "John" and "Mark" then it's going to be a little more difficult because you can't say:

... IS BETWEEN "John" AND "Mark" ...

(Unfortunately for you, MySQL doesn't have a "Biblical" type for sorting...)

Reply With Quote
  #5  
Old April 23rd, 2003, 10:57 AM
kimy_cool kimy_cool is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 6 kimy_cool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ohh Yes

my database has a unique id for every book i.e Genesis is 01, Exodus 02........etc. How can this help?

Kimy_cool

Reply With Quote
  #6  
Old April 23rd, 2003, 01:55 PM
kimy_cool kimy_cool is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 6 kimy_cool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have an idea of solving this problem on mysql but not in php. Can someone help me pass the parameters in some other or same method mind you the BETWEEN .....AND..safely in PHP?!!

Actually, let say i want to retrieve all bible verses between a this range Ezra 2:2 - 3:18.

Below is a working SQL script
Quote:
select * from bible where booktitle = 'ezra' and (chapter between '002' and '003') and (verse between '002' and '018')


One possible solution i tried though did not work is passing the whole query on the url e.g

PHP Code:
../bible.php?booktitle=jeremiah&chapter=010&verse=011&endchapter=011&endverse=021 


Below are the table fields.
Quote:
Table fields: book(int unique), booktitle(varchar), chapter(varchar), verse(varchar)


Help most welcome

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Retrieving URL Parameters


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway