Skip to content

Tag: php

Laravel Database Schema, Nullable Foreign

I’ve these two database tables: User Tables Partner Tables User Tables will handle this kind of informations While Partner Tables will contains all the user meta information such as first name and last name, etc. When a user is register to the site I only want few fields which are, username, email addre…

WordPress add responsive srcset header image to theme

WP introduced support for srcset in version 4.4 for Thumbnails and Post images. But I can’t find a way to make the page header responsive. Here is how I embed the Page header: This loads the header image (which can be uploaded in the backend > Design > Customise) in an src. But I’d rather in…

php replace array value

I have following mysql query function: I get an array of objects with multiple keys: I am sending the whole array to the js via ajax. However, I want to change the date format to “ago” and send it to js. I have the “ago” function, but I am not sure how to target the date value and put …

how to convert from base64 to hexadecimal in php?

I was thinking to use this: The output for this example should always be 18 characters! But sometimes this output is less than 18. 24 (base64 characters) multiplied by 6 (bits per base64 character) equals to 144 (bits) divided by 8 (bits per ASCII character) equals to 18 ASCII characters. The problem is that …

MySQL select user motto

I am stuck on this problem and I have been trying to solve for like 2 hours. I have a posts table which contains all posts. Each post has a column called ownerid which keeps the id of the owner of this post. And it also contains a column called groupid. What I want to have is to select all