The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
extracting from a pattern
I've got this pattern in a category table:
PHP Code:
then from those results I need to do another query in another subcategory table in order to get the name from those subcats id and create a list with a link for each one of them like a href= view.php?subcat=35>subcat 35 name a href= view.php?subcat=15>subcat 15 name etc.... if extracted list count ==1 then instead of displaying a link I simply do a redirect to that subcat (no need to display it for selection) That one is a big toughy for me. Can someone please help? Thanks. |
#2
|
|||
|
|||
You can do it with an REGEX, but you should think about normalizing your tables and create new rows for each sub category.
|
#3
|
|||
|
|||
That's a premade script from which I am trying to extract that info. I am looking at ereg_replace. That will give me 35 15 93 101 as one line but how do I get them individually as items?
|
#4
|
||||
|
||||
explode the spaces and make them into an array
|
#5
|
|||
|
|||
That's easy to say :speechless:
I got somewhere the hard way PHP Code:
PHP Code:
PHP Code:
then I'll struggle to extract each one of them individually from array now that my $string5 looks like this PHP Code:
PHP Code:
but if I do PHP Code:
|
#6
|
||||
|
||||
just explode() $string5 using ',' as the separator
|
#7
|
|||
|
|||
I did that and I get
PHP Code:
PHP Code:
|
#8
|
|||
|
|||
There is no need for the line: $array = array($subcats);
Remove that and it will work. |
#9
|
|||
|
|||
:banana: I found a nice article about arrays and I've got everything where I wanted it, only one problem remains and you just gave me perhaps a solution. The count is what is wrong. I have nine items but it is printing 90...
edit: hihihi take that back... the "0" was from an echo I forgot to remove. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|