So, after making a new youtube page, I noticed that some of my current users who have linked their youtube channels via youtube API and into our database, some of those users channels now give Error, where they no longer exist.
https://gyazo.com/d2ca429e408c9d843ee6e848ac8c4dda
So I am basically creating the subscribe buttons from this code in an echo in my function.
<div class="g-ytsubscribe" data-channelid="'.$youtube_info['channel_id'].'" data-layout="full" data-count="default" data-onytevent="onYtEvent"></div>
So as you can see, I fetch that data from my database and it then contacts youtube to fetch that channel info. But some of my users channels now no longer exist, so I wondered if there was a way to detect this? and then to not display that particular user from being displayed at all?
so my query is this for the function.
$query = "SELECT user_id, yt_channelTitle, channel_id FROM points WHERE channel_id !='' AND yt_channelTitle != '' ";
$query .="ORDER BY channel_id DESC LIMIT " . ($objectsPerPage*2) . " OFFSET " . $_SESSION['last_record'];
I mean I was maybe thinking accross the lines of some type of maybe str_replace? method perhaps? but then it would be a question of what is it detecting the word Error
because that is what gets displayed in the youtube button instead of the channel subscriber count and profile image, it just shows a red icon with Error.?? I am open to ideas :)
Thanks