Top Poster
#1 ramon fincken 404
#2 Site admin 3
#3 Ber|Art 2
#4 braddmark 1
#5 accentmedia 1
#6 Xarzu 1
#7 khadish 1
#8 moxxx 1
#9 nistelrock 1
#10 Justin-ServerPilot 1

The time now is Sat Apr 17, 2021 12:07 pm Forum Index
View unanswered posts
Split colum item in multiple colums
Author ramon fincken :: Posted: Thu Mar 18, 2021 9:28 am :: Category: Mysql databases
Tagged: , , ,

Split column item in multiple columns, and fill with empty if field Quantity is less then the split

Split on ; character.
The coupons column is " coupon1;coupon2 " etc .. and it needs to be split for the export we need.

SELECT id, `Quantity`, `email`, coupons

,SUBSTRING_INDEX(coupons,';',1) 'coupon1'
,IF(Quantity>1, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',2),';',-1) , '')  'coupon2'
,IF(Quantity>2, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',3),';',-1) , '')  'coupon3'
,IF(Quantity>3, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',4),';',-1) , '')  'coupon4'
,IF(Quantity>4, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',5),';',-1) , '')  'coupon5'
,IF(Quantity>5, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',6),';',-1) , '')  'coupon6'
,IF(Quantity>6, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',7),';',-1) , '')  'coupon7'
,IF(Quantity>7, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',8),';',-1) , '')  'coupon8'
,IF(Quantity>8, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',9),';',-1) , '')  'coupon9'
,IF(Quantity>9, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',10),';',-1) , '')  'coupon10'

FROM `coupons`

wp-cli delete all with custom keep-me table
Author ramon fincken :: Posted: Mon Jan 18, 2021 7:06 pm :: Category: CMS-ses (Joomla, WordPress, etc..)

wp-cli post delete $(wp-cli db query --socket=/usr/local/mysql/data/mysql.sock --skip-column-names --batch "SELECT post_id FROM wp_postmeta WHERE post_id < 1010313 AND post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'attachment' AND ID NOT IN ( SELECT meta_value FROM wp_found ) ) AND meta_key = '_wp_attached_file' LIMIT 200") --force

you need a limit if you expect many thousands of IDS, this is due to a bash limit, not your WP site or the DB

use at your own risk, this is more complex than you might think!

[solution] Letsencrypt Please choose an account
Author ramon fincken :: Posted: Fri Jan 15, 2021 9:58 am :: Category: Bash, perl, python and CLI linux

Duplicates in your accounts, fix them by pointing to the newest account. MAKE SURE your know which account is the most new.

/etc/letsencrypt/accounts# find -type d

/etc/letsencrypt/accounts# rm -rf ./

cd /etc/letsencrypt/renewal
sed -i 's/some-old-hash/the-new-hash/g' *.conf

[WordPress] creating PHP patches for WordPress Make Core and setting it up
Author ramon fincken :: Posted: Fri Oct 30, 2020 8:40 am :: Category: CMS-ses (Joomla, WordPress, etc..)

Do you want to contribute your PHP skills to WordPress Core?

Use this manual to get started !

# For to make PHP patches Razz To make children happy

# Download
svn co wordpress_make
cd wordpress_make

# JS and CSS
npm install
npm run build
npm run dev

copy wp-config-sample.php to wp-config.php and edit accordingly (do not forget to create a new DB !)

# Install and do your coding

# PHP unit test

#WARNING: You might need to install an older version
sudo apt install phpunit
copy wp-tests-config-sample.php to wp-tests-config.php and edit accordingly (do not forget to create a *new* DB !)


# Patch and submit to trac
svn diff filename.php > filename.diff

[fix] How to add the clock seconds to ubuntu 20.04
Author ramon fincken :: Posted: Tue Aug 04, 2020 6:27 am :: Category: Ubuntu

sudo apt install dconf-editor

Then open dconf GUI

Search for "seconds" or go to /org/gnome/desktop/interface/clock-show-seconds


Related read:

[solution] htaccess rewrite to parent folder
Author ramon fincken :: Posted: Fri Dec 13, 2019 12:23 pm :: Category: PHP coding

when some idiot decides to put a whole site in a (dated) subfolder like


and you want to migrate to another host and set things strait ( meaning www/ ) you will end up with A LOT OF 404 urls

You need to create a 2018 folder and put this in your htaccess to redirect 301 all requests to the parent root folder

RewriteRule ^(.*)$ https://www.fulldomain.ext/$1 [R=301,L]

[chrome] re-add (unhide) www in address bar
Author ramon fincken :: Posted: Thu Oct 31, 2019 1:34 pm :: Category: Ubuntu


Omnibox UI Hide Steady-State URL Trivial Subdomains

to Disabled and restart to see the www. again.

[solution] composer "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Author ramon fincken :: Posted: Mon Sep 02, 2019 3:08 pm :: Category: Bash, perl, python and CLI linux

composer install

"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

if it is NOT your PHP (when as zip); don't forget to update your composer!!
find . -type f -name '*.php' -exec php -l {} \; |grep -v "No syntax errors detected"

/usr/local/bin/composer self-update

All times are GMT
Who is Online
Who is Online Our users have posted a total of 409 articles
We have 26 registered users
The newest registered user is MathewCow
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest   [ Administrator ]   [ Moderator ]
Most users ever online was 41 on Wed Sep 09, 2015 1:34 am
Registered Users: None
This data is based on users active over the past five minutes
Log in
Username:    Password:      Log me on automatically each visit    

New posts New posts    No new posts No new posts    Forum is locked Forum is locked
General forums
The world of freelance
Other projects
I love gifts

Yes goodies and presents! [3]
No but I love polls ! [1]

Related google ads