Jump to content

[SOLVED] [Solved] Specialized Searching, Search for parts of strings.


SPraus

Recommended Posts

Hello Everyone,

I am looking for some help on a specialised searching function.

 

Here is what I have.

 

Bob;Joe;Jim;Another Example Name;

 

This is contained in an SQL database, each of these are tags for a product such as things made for computers only or just made for cars. I would like to search for a ; and save only what is before it.

 

Here is kinda what I think.  the {} are just for more explanation

$char = ;

SearchStr($string,$char)

now copy the stuff before the ;

for the next copy from ; number 2 to ; number 1. and so on and so forth.

 

Please help if you have any ideas.

SPraus

PS if you dont understand please reply and I will try to explain more. I know i didnt explain it too well. Thanks again

Link to comment
Share on other sites

i think what you want is Explode()

 

$names = "John;Sally;Susan;Chris";

$nameArray = explode(";",$names);

 

now what you have is an array of names where you can go through each one individually

$nameArray[0] = "John"

$nameArray[1] = "Sally"

...etc

 

if this isn't what you want you need to explain more about exactly what you are searching for and what you want to do with the data

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.