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
https://forums.phpfreaks.com/topic/4666-kinda-dumb-question/
Share on other sites

Archived

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

×
×
  • 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.