Jump to content

Kinda dumb question...


AV1611

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.