Hello,

I wonder why in this specific sql table I do not see edit, copy & delete in xampp:

from_stu_username date messages to_stu_username
admin 0000-00-00 messages btjong

-----------------------

Other Sql Table has Edit, Copy & Delete Except for messages.

Here is my php code for adding the new data in it:

add_message.php

<?php

    include('../../includes/koneksi.php');

    $from_stu_username = isset($_POST['from_stu_username']) ? $_POST['from_stu_username'] : '';  
    $messages = isset($_POST['messages']) ? $_POST['messages'] : '';  
    $date = isset($_POST['date']) ? $_POST['date'] : '';  
    $to_stu_username = isset($_POST['to_stu_username']) ? $_POST['to_stu_username'] : ''; 
    $confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';


    //Simpan berita 
    if (isset($_POST['ok'])){

            echo "from : ".$from_stu_username.'<br>';
            echo "to : ".$to_stu_username;

            //$idresult = mysql_query("SELECT student_id FROM student WHERE ".$_SESSION['username']) or die(mysql_error());

            //$data = mysql_fetch_array($idresult);
            //$from_stu_username_id = $data['student_id'];

            $sqlstr = "INSERT INTO `messages`(from_stu_username, messages, date, to_stu_username) VALUES('".$from_stu_username."','".$messages."','".$date."','".$to_stu_username."')";


        $result = mysql_query($sqlstr) or die(mysql_error());

        //Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
        //if (empty($_REQUEST['id']))   kirimEmail($idKategori, $judul, $news);
        $confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";  
    }
    /*
        //Load berita
    if (!empty($_GET['student_id'])){
        $result = mysql_query("SELECT * FROM `student` WHERE student_id =".$_GET['student_id']) or die(mysql_error());
        $data = mysql_fetch_array($result);
        $student_id = $data['student_id'];
        $student_name = $data['student_name'];
        $student_address = $data['student_address'];
        $student_telp = $data['student_telp'];
        $student_hp = $data['student_hp'];
        $whatsapp = $data['whatsapp'];
        $skype = $data['skype'];
        $facebook = $data['facebook'];
        $twitter = $data['twitter'];
        $student_picture = $data['student_picture'];

    }
    else {
    echo "unable to select data".'<br>';
    echo "student_id is empty";
    } */
    ?>
    <div align="center">
        <div style="width:800px;text-align:left;">
        <?php echo $confirmation;?>
        <form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
            <!-- <input type="hidden" name="id" value="<?php// echo $id; ?>"/>-->
            <table>                          
                <tr>
                    <td>From:</td>                
                    <td><input type="text" size="20px" name="from_stu_username" value="<?php echo $_SESSION['username']; ?>" ></td>
                </tr>
                <tr>
                    <td>To:</td>
                    <td><?php

                    $rs = mysql_query("SELECT * FROM `student`") or die(mysql_error());                 
                    echo "<select name='to_stu_username'>";
                    while($data = mysql_fetch_array($rs)){
                        echo "<option value='".$data['stu_username']."'>".$data['stu_username']."</option>";
                        }
                    echo "</select>";

                    ?></td>
                </tr>
                <tr>
                    <td>Messages:</td>
                    <td><textarea name="messages" rows="4" cols="50"></textarea></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" name="ok" value="Simpan" class="abutton"/></td>
                </tr>        
            </table>
        </form>
        </div>
    </div>
</div>    


<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>   
<p>&nbsp;</p>

<?php include('../adminfooter.php'); ?>
</body>
</html>

GRANT select (id,name) ON Users To Dani
where id and name are cols in table Users

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.