Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


mysql experts ? how to do this - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

mysql experts ? how to do this

2»

Comments

  • nemnem Member, Host Rep

    @raindog308 said:
    To summarize long-standing wisdom: regex is the wrong way to handle HTML.

    Or in more detail...

    You'd want to pull the data from database, parse DOM, remove all matching A nodes, then reinject back into the database. Applying a regex to it... 50/50 shot of breaking your HTML structure especially if malformed.

    Thanked by 1yoursunny
  • jsgjsg Member, Resident Benchmarker

    @jbiloh, @FAT32

    I'm extremely p_ssed off because

    • I took the time and made the effort to write a helpful post for OP that was based on concrete experience and offered a solution to OPs problem - then Clouf%&°! (or Vanilla?) popped up and asked me to do a captcha without even giving me the chance to do it.
    • Then I made the additional effort to edit both my post and OPs post quote - same sh_tty result
    • Then I crippled the post to a ridiculous extent like replacing 'href tag + url' by '[HREF] URL' (verbatim!) - yet I again couldn't post it, highly likely because I hadn't crippled the SQL stuff which OPs question was about!.

    So, the situation is that a user asks for help, I can provide that help - based on concrete practical experience - and even a full "just copy and insert your variable" solution BUT I'M F_CKING BLOCKED from posting it.

    Gentlemen, if CloudF%&#! nukes the very reason of existence of this forum it's about time to throw out the "protection" rather than asked for solutions and angry users.

    @momkin

    I'm sorry, I had a full - and known to work well - solution for you but I can't post it thanks to CloudF_ck and/or Vanilla being aggressively imbecile. I'd be willing to send it by PM but I'm virtually sure that won't work either. Sorry.

  • MrEdMrEd Member

    @jsg you could use some paste bin site for your solution and place a link to it ;)

    Thanked by 2Falzo Chronic
  • jsgjsg Member, Resident Benchmarker

    @MrEd said:
    @jsg you could use some paste bin site for your solution and place a link to it ;)

    Thanks, what good is a forum for if I need to put my solution on another site? Making it hard for experienced user to share their experience and knowledge and to provide solutions and help is about the worst thing a forum can do.
    And btw I've already jumped through quite a few loops to (try to) provide a solution.

  • momkinmomkin Member
    edited July 2020

    @jsg there is a lot of ways to share your solution like https://pastebin.com/ or you could also answer my question in https://stackoverflow.com/questions/63019017/mysql-delete-text-starting-and-ending-with-specific-words

    This way it will be helpful for others !

    Thank you for your time and effort !

  • jsgjsg Member, Resident Benchmarker
    edited July 2020

    @momkin said:

    As you ask so constructively and nicely ...

    @momkin said:
    So what I'm looking for is a query to remove the text that starts with

    [HREF]
    and ends with
    [End of HREF]

    Any help will be appreciated !

    No. What you want is highly likely a way to remove text that starts with '[HREF]="URL1"' or with '[HREF]="URL2"' and ends with '[End of HREF]' - or do you really want to delete all links?

    I occasionally had to do something similar when moving and cleaning a WP blog. The way I chose was to

    https://paste.gg/p/anonymous/66074d0273514d449fcdd170b752973b

    (Note: link will expire after 24 hours)

    Thanked by 1vimalware
  • jbilohjbiloh Administrator, Veteran

    @jsg regret the inconvenience. Cloud flare is not perfect and I know there are some frustrating oddities that occur.

  • jsgjsg Member, Resident Benchmarker

    Funny. I shared a known to work well solution incl. concrete how-to, changed my post multiple times to make it pass, and finally put it on some paste bin as suggested.

    And not even a simple "thank you". Lesson learned, thank you.

    Thanked by 2vimalware yoursunny
  • FalzoFalzo Member

    @jsg said:
    Funny. I shared a known to work well solution incl. concrete how-to, changed my post multiple times to make it pass, and finally put it on some paste bin as suggested.

    And not even a simple "thank you". Lesson learned, thank you.

    you lost him at parameterized but latest at python or lua

    do you think, if he would feel comfortable with that he would have asked his question in the first place? ;-)

  • momkinmomkin Member

    @jsg said:
    Funny. I shared a known to work well solution incl. concrete how-to, changed my post multiple times to make it pass, and finally put it on some paste bin as suggested.

    And not even a simple "thank you". Lesson learned, thank you.

    i don't see any ( ready to go tutorial )
    what i see is you asking me to do thing with other programming languages python or lua which far away what i'm seeking for .

    Anyway thank you very much for your time and effort i really appreciate it .

  • momkinmomkin Member

    Anyone got an easy way to do this ??

  • KatamazeKatamaze Member
    edited July 2020

    You have to use PHP & DOM. I wrote a function on the fly but this damned Cloudflare is driving me crazy! It keeps asking to complete a CAPTCHA I can't see! I've been forced to post the code on Github :/ here:

    https://github.com/Kian987/Random-Stuff/blob/master/Stuff/WordPress.php

    I will remove it later. Anyway here's the before/after in database:

    The only problem is that DOM keeps adding <p></p> tags even if I used LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD. Well it's too late now. I have no time to explain. I wasted too much time because of Cloudflare :|

  • momkinmomkin Member

    @Katamaze said:
    You have to use PHP & DOM. I wrote a function on the fly but this damned Cloudflare is driving me crazy! It keeps asking to complete a CAPTCHA I can't see! I've been forced to post the code on Github :/ here:

    https://github.com/Kian987/Random-Stuff/blob/master/Stuff/WordPress.php

    I will remove it later. Anyway here's the before/after in database:

    The only problem is that DOM keeps adding <p></p> tags even if I used LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD. Well it's too late now. I have no time to explain. I wasted too much time because of Cloudflare :|

    Thanks mate how can i use this script exactly ?
    I mean how can i link to my database to make the changes ?

  • KatamazeKatamaze Member
    edited July 2020

    I'm not using WordPress hence I created a wp_post table on the fly following this structure. What you need are:

    • id (to update the post once you removed unwanted URL blocks)
    • post_content that contains the actual comment

    That said, I've added comments to the original script so that you can get an idea of how it works. Of course you'll need to adapt it to your needs sinc as I said earlier I'm not using WordPress.

  • momkinmomkin Member

    @Katamaze said:
    I'm not using WordPress hence I created a wp_post table on the fly following this structure. What you need are:

    • id (to update the post once you removed unwanted URL blocks)
    • post_content that contains the actual comment

    That said, I've added comments to the original script so that you can get an idea of how it works. Of course you'll need to adapt it to your needs sinc as I said earlier I'm not using WordPress.

    Hi ,
    I'll try to make it work with WordPress , Thank you very much for your help !

  • Webdock_ioWebdock_io Member, Host Rep

    What I would try is using WP-CLI as that is a reasonably safe / easy way to do DB replacements. I would:

    1 Back up the database!

    2 Instal WP-CLI and do the replace command

    You can get WP-CLI from here https://wp-cli.org/

    And an example on how to use the replace command - although not exactly what it is you want here, but is close:

    https://webdock.io/en/docs/wordpress-guides/fixing-wordpress-redirect-issues

  • momkinmomkin Member

    @Webdock_io said:
    What I would try is using WP-CLI as that is a reasonably safe / easy way to do DB replacements. I would:

    1 Back up the database!

    2 Instal WP-CLI and do the replace command

    You can get WP-CLI from here https://wp-cli.org/

    And an example on how to use the replace command - although not exactly what it is you want here, but is close:

    https://webdock.io/en/docs/wordpress-guides/fixing-wordpress-redirect-issues

    This can easy be done without wp cli i can do it without it , wp cli is useless , what i requested is more complicated !

  • @momkin said:

    is more complicated !

    This is usually the hint that you need a scripting language with batteries included. (for parsing markup.)

  • angstromangstrom Moderator
    edited May 2021

    So you signed up to necropost and spam?

    No congrats on your first post

Sign In or Register to comment.