简体   繁体   中英

PHP (MySQL) Script doesn't read anything else once I add 'echo' and take something from table

I have a problem,

When I tried to list all users, to get their username/and others script didn't continue to read anything, it has stopped just after my echo input.

So when I put echo to get user's info it reads that input but it doesn't read anything after. See bellow there is a echo called 'userEmail' and it reads it with no problems but it doesn't go after signature. Now I have checked any everything works when i put it on a plain page but for some reason it stop readsing here. I'm a newbie in this PHP so yeah. :)

<?php 
$query = mysql_query("SELECT userEmail FROM users");

while($userRow= mysql_fetch_array($query)){
    echo '<div class="col-md-4">
            <!-- Widget: user widget style 1 -->
            <div class="box box-widget widget-user">
                <div class="widget-user-header bg-blue" style="background-color:  center center;">
                </div>
                <div class="widget-user-image">
                    <img alt="User Avatar" class="img-circle" src="//">
                </div>
                <div class="box-footer">
                    <div class="row">
                        <div class="col-sm-4 border-right">
                            <div class="description-block">
                            </div>
                            <!-- /.description-block -->
                        </div>
                        <!-- /.col -->

                        <div class="col-sm-4 border-right">
                            <div class="description-block">
                                <h5 class="description-header">'.$userRow['userEmail'];'</h5>
                                <h5 class="description-text">'.$userRow['userSignature'];'</h5>
                            </div>
                            <!-- /.description-block -->
                        </div>
                        <!-- /.col -->
                        <div class="col-sm-4">
                            <div class="description-block"></div>
                        <!-- /.description-block -->
                        </div>
                        <!-- /.col -->
                    </div>
                    <!-- /.row -->
                </div>
            </div>
            <!-- /.widget-user -->
        </div>
        <!-- /.col -->
    </div>';
}
?>

You're ending your echo with a ; . You need to concatenate the string with a . instead:

<h5 class="description-header">'.$userRow['userEmail'];'</h5>
<h5 class="description-text">'.$userRow['userSignature'];'</h5>

This should be:

<h5 class="description-header">'.$userRow['userEmail'].'</h5>
<h5 class="description-text">'.$userRow['userSignature'].'</h5>

in '.$userRow[' quates are conflict with together
change ' and " with together in all lines of your script and then :

".$userRow['userEmail']."<

be sure will be ok

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM