0

私は次のphpとsqlのコードを持っています、それは完全に機能します、ユーザーはtblactionsの4つのケースのうちの少なくとも1つを持っています。この問題は、たとえば出席など、ユーザーが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 に答える