Note that there are some explanatory texts on larger screens.

plurals
  1. POSimpleXML loop works but breaks half way through
    primarykey
    data
    text
    <p>I have a loop going through results from a youtube feed and it works fine but towards the end it fails with the error:</p> <pre><code>Warning: main() [function.main]: Node no longer exists in ../youtubereader.php on line 8 Warning: main() [function.main]: Node no longer exists in .../youtubereader.php on line 8 Fatal error: Call to a member function attributes() on a non-object in .../youtubereader.php on line 9 </code></pre> <p>My code is:</p> <pre><code>&lt;?php error_reporting(E_ALL); $feedURL = 'http://gdata.youtube.com/feeds/api/users/USERNAME/uploads?max-results=50'; $sxml = simplexml_load_file($feedURL); $i=0; foreach ($sxml-&gt;entry as $entry) { $media = $entry-&gt;children('media', true); $watch = (string)$media-&gt;group-&gt;player-&gt;attributes()-&gt;url; $thumbnail = (string)$media-&gt;group-&gt;thumbnail[0]-&gt;attributes()-&gt;url; ?&gt; &lt;div class="videoitem"&gt; &lt;div class="videothumb"&gt;&lt;a href="&lt;?php echo $watch; ?&gt;" class="watchvideo"&gt;&lt;img src="&lt;?php echo $thumbnail;?&gt;" alt="&lt;?php echo $media-&gt;group-&gt;title; ?&gt;" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="videotitle"&gt; &lt;h3&gt;&lt;a href="&lt;?php echo $watch; ?&gt;" class="watchvideo"&gt;&lt;?php echo $media-&gt;group-&gt;title; ?&gt;&lt;/a&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo $media-&gt;group-&gt;description; ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php $i++; if($i==3) { echo '&lt;div class="clear small_v_margin"&gt;&lt;/div&gt;'; $i=0; } } ?&gt; </code></pre> <p>My xml comes back from youtube fine and there are definitely more results than where it breaks, any ideas why it would do this?</p> <p><strong>Edit:</strong> Tested locally, using wamp and it works fine. Still not on server. Live, the thumbnails after item 24 no thumbnails are returned.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload