Hi everyone
So I wanted to add a ‘phone number’ column in my inbox page
I went to MySQL database and phpMyadmin to make some changes, what I did was go to the table and
click on change (the pencil icon)
then I go to insert new row and click go
and it generate error message: “#1062 - Duplicate entry ‘1’ for key 1”
and id_member column appear in the table
then I delete the the id_member column but it generated error when I tried to send the message
and I tried to make some changes but it messes up even more, now everytime I click on send message or kirim pesan (in my language) the data goes to the database but it nothing appear on my inbox
This is my send message box:
this is the php coding:
[code]<?php
if($kirim==“ya”)
{
$anton->generatetanggal();
$ip=$_SERVER[‘REMOTE_ADDR’];
$s=“select * from inbox
where tgl
like ‘$fulldate’ and alamat_ip
like ‘$ip’”;
$anton->kueridb($s);
$jum=0;
while($r=mysql_fetch_row($hasil))
{
$jum++;
}
if($jum<20)
{
$dari=strip_tags($dari);
$subjek=strip_tags($subjek);
$pesan=strip_tags($pesan);
$s="INSERT INTO `inbox` (
id
,
dari
,
subjek
,
pesan
,
id_member
,
tgl
,
desc
,
alamat_ip
)
VALUES (
NULL , ‘$dari’, ‘$subjek’, ‘$pesan’, ‘$fulldate’, ‘id_member’, ‘-’, ‘$ip’
)";
$anton->kueridb($s);
if($hasil)
{
echo "<center><br><b>Data pesan Anda telah terkirim ke member tersebut ! </b></center>";
}
}
}
else
{
?>
Kirimkan Pesan ke Pemasang Iklan | |
Nama Anda | |
Subjek | |
Pesan Anda | |
<?php } ?>[/code]
[code]<?php
if(empty($_SESSION[‘rmember’]))
{
echo “
Maaf untuk mengakses halaman ini silahkan <a href=?page=login>login jika Anda sudah memiliki akun, jika Anda belum memiliki akun, silahkan <a href=?page=register>register”;
require_once(“inc/login.php”);
}
else
{
$rmember=$_SESSION[‘rmember’];
$rid=$_SESSION[‘rid’];
?>
Kotak Pesan
<?php if($aksi=="delete") { $s="select * from `inbox` where `id` like '$id'"; $anton->kueridb($s); $r=mysql_fetch_row($hasil); $id_member=$r[5]; if($id_member==$rid) { $s="delete from `inbox` where `id` like '$id'"; $anton->kueridb($s); } } $s="select * from `inbox` where `id_member` like '$rid'"; $anton->kueridb($s); echo "Tanggal | Pengirim | Subjek | Pesan | Hapus |
$r[4] | $r[1] | $r[2] | $r[3] | Hapus |
"; } ?>
[/code]
everything starting to get mess up after I did “set as new row” which gave me an error message: “#1062 - Duplicate entry ‘1’ for key 1” what does it mean?
and then a new column (id_member)appears on the table, which I then deleted it, but it gave me an error message on the inbox about missing id_member field, so I have to add it back tot the table (it wasn’t there before).
Before the table has no “id_member” column but after I “set as new row” and get “#1062 - Duplicate entry ‘1’ for key 1"” I have to add the id_member column to the table or the inbox give me error message about missing id_member filed
sorry for asking too much, cause I’m very new to this, I didn’t create the website, so I have no idea about the coding, etc. just wanted to add 1 column.
How do the “id_member” colum get added to the table? and since I delete it soon after, I have no idea about its configuration (INT, or TEXT, etc.) but since the inbox page keep asking me to add “id_member” ever since so I have to add it to the table.
I did deleted the “id_member” from php code, because I thought it was added by the database accidently, but then I put the “id_member” back to the code since otherwise the inbox page give me error message
Sorry for my english, and long post but I try to explain it as clear as possible.
thanks