Birden fazla koşullu Statment hatası, Sorun nedir

0 Cevap php

Ben bu hatayı alıyorum ...

Parse error: syntax error, unexpected '{', expecting '(' in /home/content/s/k/y/skyview09/html/clients/Cheryl/admin/admin.php on line 122

Birden fazla koşullu ifadeleri (if, elseif, else) ile bir sayfayı çalıştırmak için çalışırken.

Ben çalıştırmak için bağlıyorum php:

<?php

            if(isset($_GET['message'])){
                echo "<p><font color='#fff'>Your update was successful!</font></p>";
            }

            require("includes/connection.php");
            $article = (isset($_GET['article'])) ? $_GET['article'] : "1";
            $page = (isset($_GET['page'])) ? $_GET['page'] : "1";
            $nav = (isset($_GET['nav'])) ? $_GET['nav'] : "none";

            if($nav != "none"){

                $sql = "SELECT id, name, url, title content FROM nav WHERE id='$nav'";
                $result = $conn->query($sql) or die('Something is wrong on the test.php...Check it OUT! admin page, navigation');
                if($result){
                    $row = $result->fetch_object();
                    echo '<form method="post" action="update.php">';
                    echo '<input type="hidden" name="id" value="' . $row->id . '" />';
                    echo 'Name: <input type="text" name="name" value="' . $row->name . '" /><br>';
                    echo 'Url: <input type="text" name="url" value="' . $row->url . '" /><br>';
                    echo 'Title: <input type="text" name="title" value="' . $row->title . '" /><br>';
                    echo '<input type="submit" name="editLinks" value="Update Content" />';
                    echo '</form>';
                }

            } elseif {

            $sql = "SELECT id, content FROM articles WHERE id='$article'";
            $result = $conn->query($sql) or die('Something is wrong on the test.php...Check it OUT! admin page, articles');
                if($result){
                    $row = $result->fetch_object();
                    echo '<form method="post" action="update.php">';
                    echo '<input type="hidden" name="id" value="' . $row->id . '"';
                    echo '<textarea name="content" cols="50" rows="15">';
                    echo $row->content;
                    echo '</textarea>';
                    echo '<input type="submit" name="editContent" value="Update Content" />';
                    echo '</form>';
                }
            }

            else {

            $sql = "SELECT id, content FROM pages WHERE id='$page'";
            $result = $conn->query($sql) or die('Something is wrong on the test.php...Check it OUT! admin page, pages');
                if($result){
                    $row = $result->fetch_object();
                    echo '<form method="post" action="update.php">';
                    echo '<input type="hidden" name="id" value="' . $row->id . '"';
                    echo '<textarea name="content" cols="50" rows="15">';
                    echo $row->content;
                    echo '</textarea>';
                    echo '<input type="submit" name="editContent" value="Update Content" />';
                    echo '</form>';
                }
            }
            ?>

Ben "elseif" deyiminin yerde olmak son "else" deyimi istiyorum. Ve elseif sonuncusu olması. Ben bazı çözümler denedim, ama hiçbir şey gerçekten çalıştı. Ben sorunun ne olduğunu bilmiyorum.

Ben SO sorular benim sorun zaten çözüm bulmak düşündüm, ama onlar benim için sorun değil tam değilsin. Ben yardım takdir ediyorum.

0 Cevap