Jump to content

Recommended Posts

hey guys i have a table streams

that has multiple columns but i need one and brake the string?

stream_source

contains

["http:\/\/server:8080\/9Lx0YfoxZp\/DexfrUxcn\/2107"]

 

so i need just http:\/\/server:8080 as dns   9Lx0YfoxZp as username  and DexfrUxcn as password

i have tried a few was like this example..

 

but no luck im guessing its because i first need to remove ["  ?

SELECT SUBSTRING_INDEX(stream_source, '  \/ ', 1) AS dns, SUBSTRING_INDEX(SUBSTRING_INDEX(stream_source,'  \/ ', 2), ' ',-1) AS mname, SUBSTRING_INDEX(stream_source, ' \/ ', -1) as lname FROM streams;

Link to comment
https://forums.phpfreaks.com/topic/310824-how-to-split-entry-from-column/
Share on other sites

the database entry is json format

 

["http:\/\/server:8080\/9Lx0YfoxZp\/DexfrUxcn\/2107"]  and has other fields like name......

cause the panel fetched the info and encodes it in json for output to selected file needed...

but i just noticed that it has all entries so database table can contain 15000 streams...

so i would need to check and remove duplicates....

or like you say i can use the existing api and read the json but it can take long time if to many results....

Switch to a JSON data type for that column, deal with any invalid data that crept in, then create a VIEW that does the nasty work of extracting values and parsing strings and whatever.

Then use the VIEW for your deduplication work.

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.