0

我有以下 php 和 sql 代码,它完美地工作是用户在 tblactions 中至少有 4 个案例中的一个。如果用户只有 1 个案例,例如参加,则会出现问题。然后它似乎进入一个无限循环并且页面不会加载。谁能帮我修改这段代码?

 $result5 = mysql_query("SELECT tblactions.*, fgusers.username FROM tblactions LEFT JOIN fgusers ON fgusers.id_user = tblactions.following_id WHERE user_id = '$test' ORDER BY timestamp DESC")

    while ($row5 = mysql_fetch_array($result5))
    {
        $actiontype = $row5['type'];
        switch ($actiontype)
    {
    case "event":

       echo '<div id="peepme" class="ui-btn-text">',
            '<img id="peoplemeimg" alt="Happps" src="image/'.$row7['photo'].'" class="ui-li-thumb">',
            '<h3 id="pmh3" class="ui-li-heading">',$row5['user_name'], ' created the event','</h3>', 
            '<a id="pmevent" data-ajax="false" class="ui-li-heading" href="eventview.php?eventid='.$row5['event_id'].'">',$row5['event_name'],'</a>',

            '</div>';
       break;

    case "follow":

       echo '<div id="peepme" class="ui-btn-text">',
            '<img id="peoplemeimg" alt="Happps" src="image/'.$row7['photo'].'" class="ui-li-thumb">',
            '<h3 id="pmh3" class="ui-li-heading">',$row9['username'], ' started following','</h3>', 
            '<a id="pmevent" data-ajax="false" class="ui-li-heading" href="people.php?id='.$row5['following_id'].'">',$row5['username'],'</a>',

            '</div>';

       break;

    case "photo":

    echo '<div id="peepme" class="ui-btn-text">',
         '<img id="peoplemeimg" alt="Happps" src="image/'.$row7['photo'].'" class="ui-li-thumb">',
         '<h3 id="pmh3" class="ui-li-heading">',$row9['username'], ' uploaded a photo','</h3>', 
         '<div id="imgupld">','<img id="upldimg" alt="Happps" src="image/'.$row5['photo'].'" class="ui-li-thumb">',

         '</div>',                  
         '</div>';

       break;

    case "attending":

    echo '<div id="peepme" class="ui-btn-text">',

         '<img id="peoplemeimg" alt="Happps" src="image/'.$row7['photo'].'" class="ui-li-thumb">',
         '<h3 id="pmh3" class="ui-li-heading">',$row9['username'], ' is attending ','</h3>', 
         '<a id="pmevent" data-ajax="false" class="ui-li-heading" href="eventview.php?eventid='.$row5['event_id'].'">','This Event','</a>',

         '</div>';


        }?> 
4

1 回答 1

2

这是错误。

case "attending":

echo '<div id="peepme" class="ui-btn-text">',

        '<img id="peoplemeimg" alt="Happps" src="image/'.$row7['photo'].'" class="ui-li-thumb">',
        '<h3 id="pmh3" class="ui-li-heading">',$row9['username'], ' is attending ','</h3>', 
        '<a id="pmevent" data-ajax="false" class="ui-li-heading" href="eventview.php?eventid='.$row5['event_id'].'">','This Event','</a>',
    '</div>';

break;

忘记打破出席案例。

于 2013-02-12T04:13:36.257 回答