Tolong pilih kategori sesuai, jenis posting (pertanyaan atau bukan) dan sertakan tag/topik yang sesuai misal komputer, php, mysql, dll.
Promosi atau posting tidak pada tempatnya akan kami hapus.
Mencantumkan kode program di posting Anda, tolong ikuti aturan yang sesuai, baca http://diskusiweb.com/discussion/39204/aturan-cara-menyisipkan-kode-program-di-diskusiweb

Baca cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

Muncul Pesan : Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C


<?php
include 'con.php';
$no = $_GET['no'];
$query = "SELECT * FROM user WHERE no = $no AND user='.$_SESSION['user_id'].";
$hasil = mysql_query($query);
$data  = mysql_fetch_array($hasil);
?>
<form method="post" action="edit-save.php">
<table width="500" border="1" cellpadding="0" cellspacing="0">
  <tr>
      <td width="23%"> No </td>
    <td width="60%"> <input type="text" name="no" disabled='disable' value="<?php echo $data['no']; ?>"> </td>
  </tr>
  <tr>
      <td>Order</td>
    <td> <textarea name="order"><?php echo $data['order']; ?></textarea></td>
  </tr>

<tr>
      <td></td> <td></td> <td> <input type="hidden" name="no" value="<?php echo $data['no']; ?>">
      <input type="SUBMIT" name="SUBMIT" value="Update"></td>
  </tr>
</table>
</form>

EDIT PROFIL : No - Nama - Email - Alamat - Username -  Password - Order


Awlanya permasalahan sdh d jawab Master BOO...(untuk edit profil semua data sdh bisa) Thanks Master...

tp setelah sy coba buat edit profil ( khusus hanya untuk  kolom ORDER )

muncul pesan  :  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C

Mohon koreksinya Master...??

Tanggapan

  • $query = "SELECT * FROM user WHERE no = $no AND user='.$_SESSION['user_id'].";

    periksa pasangan quote nya
  • edited November 2012
    ok Master thanks..scriptnya udah jalan , Tapi data yg di edit ke kolom order tdk masuk...??

    ni script edit save profil...mohon d koreksi

    <?php
    include "con.php";
     $no = $_POST['no'];
     $order = $_POST['order'];

     $query = "UPDATE user SET order = '$order' WHERE no = '$no'";
     $hasil = mysql_query($query);
     if ($hasil) {
        echo "<script>window.alert('Update Data Member Berhasil...Terima Kasih...!!!')</script>";           
    }
    ?>


  • edited November 2012
    di echo aja dolo ... query nya bener apa salah ...

    echo $query = "UPDATE user SET order = '$order' WHERE no = '$no'";
  • sdh di pake echo $query

    Mucul Pesan UPDATE user SET order = 'tessssss' WHERE no = '1'
    Update Sukses

    Tapi Data tetap tidak masuk ke kolom order

    Mohon penjelasan Master..???
  • edited November 2012
    wakakakakakak ... order pan keyword nya mysql :D

    kalo dijadikan nama field mesti ada treatment khusus ... pake backtick `order`

    ... SET `order`= ...

    tapi emang yg bener harusnya semua nama field, nama table dan nama database semestinya ditulis dengan diapit backtick `...`
  • Aduh Master tolong di koreksi script mana yg salah...?? ni contoh semua script...

    SCRIPT 1-Form Edit
    <?php
    session_start();
    if($_SESSION['ok'] != 'OK'){
    header ("location:home.php");}
    include "con.php";
    ?>
    <?php
    include 'con.php';
    $sql='select * from user where user="'.$_SESSION['user_id'].'" LIMIT 1';
    $result = mysql_query($sql);
    echo "<table border='1' cellpadding='0' cellspacing='0'>";
    while ($data = mysql_fetch_array($result)) //mysql_fetch_array = get the query data into array
    {
      echo "
              <tr><td bgcolor=\"#ffFFFF\" width=\"250\"><b><font color=\"#666666\" face=\"Arial Narrow\" size=\"3\">&nbsp;
                 ".$data['no']."
                </font></b></td></tr>
                <tr><td bgcolor=\"#ffFFFF\" width=\"250\" height=\"300\"><b><font color=\"#666666\" face=\"Arial Narrow\" size=\"3\">&nbsp;
                ".$data['order']."
                </font></b></td></tr><table>
                <table><tr><td bgcolor=\"#ffFFFF\" width=\"250\" height=\"30\" border='0'><b><font color=\"#666666\" face=\"Arial Narrow\" size=\"3\">&nbsp;
                <b> <center><a href='edit.php?no=".$data['no']."'><button> - UPDATE - </button></a> </center></b>
                </font></b></td></tr></table> ";}
    echo "</div>";
    ?>

    SCRIPT 2- Edit Profil
    <?php
    include 'con.php';
    $no = $_GET['no'];
    $query = "SELECT * FROM user WHERE no = $no";
    $hasil = mysql_query($query);
    $data  = mysql_fetch_array($hasil);
    ?>
    <form method="post" action="save.php">
    <table width="500" border="1" cellpadding="0" cellspacing="0">
      <tr>
          <td width="23%"> No </td>
        <td width="60%"> <input type="text" name="no" disabled='disable' value="<?php echo $data['no']; ?>"> </td></tr>
      <tr><td>Order</td>
        <td> <textarea name="order"><?php echo $data['order']; ?></textarea></td></tr>
    <tr><td></td> <td></td> <td> <input type="hidden" name="no" value="<?php echo $data['no']; ?>">
          <input type="SUBMIT" name="SUBMIT" value="Update"></td></tr></table>

    SCRIPT 3- Save Profil
    <?php
    include "con.php";
     $no = $_POST['no'];
     $order = $_POST['order'];
    echo $query = "UPDATE user SET order = '$order' WHERE no = '$no'";
     $hasil = mysql_query($query);
     if ($hasil) {
        echo "<script>window.alert('Update Data Berhasil.)</script>";             
    }
    ?>

    MOHON KOREKSI & PANDUAN MASTER..??Thanks
    Help..Help...help...
    ~X(
  • lha yg bermasalah pan yg ini doang to ...

    $query = "UPDATE user SET order = '$order' WHERE no = '$no'";
  • edited November 2012
    aduh Master MOHO MAAF,,,,saya yg salah....scriptnya udah jalan, masalahnya di backtick ( ` )...Terima kasih
  • lha emang tulisan ini :

    $query = "UPDATE user SET order = '$order' WHERE no = '$no'";

    ada dimana ?

    pan sudah gw tulis, ubah jadi :

    ... SET `order`= ...

    karena order itu keyword nya mysql
  • edited November 2012

    Harusnya semua nama field, nama table dan nama database semestinya ditulis dengan diapit backtick `...`

    Sangat bermanfaat penjelasannya,,,Terima Kasih...
    Maklum Master,,saya masih belajar...belum pernah ketemu masalah begitu...







    DISKUSI WEB ====> GOOD & SUKSES SELALU

    :)>-
Sign In or Register to comment.