Home  >  Q&A  >  body text

Echo inside div with nested echo

I'm trying to use echo

in this code
<?php
                            
    require 'connect.php';
    $query = mysqli_query($conn, "SELECT * FROM `videos`") or die(mysqli_error());
    while($fetch = mysqli_fetch_array($query)){
           $id= $fetch['id'];
?>
    <?php echo "
        <li class='col-lg-4 col-md-6 col-dm-12'>
        <div class='da-card box-shadow'>
        <div class='da-card-photo'>
            <img src=' echo $fetch['video_name']' alt=''>
            <div class='da-overlay'>
                <div class='da-social'> 
                    <h4 class='mb-10 color-white pd-20'></h4>
                    <ul class='clearfix'>
                        <li>
                            <a href='' data-fancybox='images'><i class='fa fa-picture-o'></i></a>
                        </li>
                        <li>
                            <a href='#'><i class='fa fa-link'></i></a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
        </li>
    "; ?>
    <?php
    }
?>

I get this errorParse Error: Syntax error, unexpected string content "", expecting "-" or identifier or variable or number at line C:\xampp\htdocs\desk\gallery.php 572 Why does this error occur? ................................................................. ....…………

P粉818317410P粉818317410221 days ago485

reply all(1)I'll reply

  • P粉348915572

    P粉3489155722024-04-05 09:23:10

    You can escape the string and concatenate the variable where you want it, like this:

    
        
            

  • "; ?>

    reply
    0
  • Cancelreply