Jump to content

Query within an echo.


jason360
Go to solution Solved by QuickOldCar,

Recommended Posts

Hey guys,

 

I am stuck on this piece of code. Within the function I am using I need to include an mysql query.  I am not sure how to insert it within the echo.  Currently the query works but the code stops once close the '' and </ul> and </section> are cut out.

 

Please note that there is alot more code within the echo, not just the section and ul.  Just simplified it for my question.

 

Any help would be appreciated.

 

Thanks


 
<?php
  $query = mysql_query('SELECT id FROM videos WHERE user="'.$id.'"');
list ($video_id) = mysql_fetch_array($query);


if ($video_id != '') {


 echo '<section>
       <ul >';


       $query = mysql_query('SELECT video FROM videos WHERE id="'.$id.'" ORDER BY RAND()');
                        
       $i = 0;
                        
        class myCounter implements Countable {
        public function count() {
        static $count = 0;
        return ++$count;
        }
        }
                                                
        $counter = new myCounter;
                        
        while ($row = mysql_fetch_array($query))
                        
        {
                        
        if($i % 5 === 0)
                        
        {
                        
                        
        }


echo "<li data-path='feeds/api/videos/".$row['video']."' ></li>";
                                               
        $i++; 
        }
                                            
'</ul>
</section>';


?>
Edited by jason360
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.