Jump to content

Archived

This topic is now archived and is closed to further replies.

AV1611

Kinda dumb question...

Recommended Posts

I need to convert a field value in a table to a field value in another table, but they are different...

The first table has links like:
[code]
<a href="../../bible.php?passage=1John+2:9">
[/code]

Here is the code from bible.php:
[code]
$tmp = $_GET['passage'];
$tmp = explode(' ',$tmp);
$book = $tmp[0];
$tmp = explode(':',$tmp[1]);
$chapter = $tmp[0];
$verse = $tmp[1];
[/code]

bible.php works great for
John+3:16
but
1John 3:16 doesn't work because the table has it a 1 John 3:16

How do I insert the space between 1 and John? It has to be after I explode the $_GET...

???



This seems to have fixed it:

[code]
$tmp = $_GET['passage'];
$tmp = explode(' ',$tmp);
$book = $tmp[0];
$tmp = explode(':',$tmp[1]);
$chapter = $tmp[0];
$verse = $tmp[1];

$book=str_replace("1","1 ",$book);
$book=str_replace("2","2 ",$book);
$book=str_replace("3","3 ",$book)
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.