masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 this is the errorColumn count doesn't match value count at row 1 Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 OK, so does that tell you what the problem is? It says the column count doesn't match the value count. Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 so how can i fix it sir ? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 Think about what the error message means, this is a database error that says the column count is wrong. What does that sound like? Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 main that i have to add column it is name is count ? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 By "column count", they mean the number of columns. The error means that the insert statement does not have the same number of columns as the table. Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 so what ca i do to fix? Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 VALUES ('','$id','$name','$receiver','$titlee','$mbody','$today_date','$ad','0','1','1')");Table structure for table hendawy_mailField Type Null Defaultid int(10) Yes NULLmem_id int(10) Yes 0sender varchar(100) Yes NULLreceiver varchar(100) Yes NULLtitle varchar(100) Yes NULLbody mediumtext Yes NULLdate varchar(100) Yes NULLtime time Yes 00:00:00eread enum('0', '1') Yes 0mshowi enum('0', '1') Yes 1mshowo enum('0', '1') Yes 1subject varchar(100) Yes NULLactivate varchar(100) Yes NULLmessage varchar(100) Yes NULL Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 subject varchar(100) Yes NULLactivate varchar(100) Yes NULLmessage varchar(100) Yes NULL this i add so send email but ididn't find time time Yes 00:00:00 Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 There are 2 ways to do an INSERT. You can either list the columns, or not. If you don't list the columns then you have to give a value for every column in the table. That's what your queries are doing, they aren't listing the columns, only the values. If you don't want to give a value for every column, then you need to list which columns you're inserting. The columns and the values need to be in the same order. e.g.:$INSERTVALUES = mysql_query("INSERT INTO hendawy_mail (mem_id, sender, receiver, ...)VALUES ('$id','$name','$receiver','$titlee','$mbody','$today_date','$ad','0','1','1')"); Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 thank you sir i did it and i fix itanother helpthis code for delet replay frome replayed table <? $asmemr1_select = mysql_query ("SELECT * from ssubject where id='$ssub_id' and active='1'"); while ($Row515=mysql_fetch_array($asmemr1_select)) { $memberr_id = $Row515[mem_id]; $asmm_select = mysql_query ("SELECT * from members where id='$member_id' and active='1'"); while ($Row16=mysql_fetch_array($asmm_select)) { $speciall = $Row16 [special]; } }if ($special == "1" AND $mem_id == $memberid){?> <tr> <td colspan="2" bgcolor="#efe8d6"> <p align="center"> <a href="index.php?action=delete_subject&rep_id=<? echo $repid; ?>&subjectid=<? echo $subjectid; ?>" ><span lang="ar-eg">حـــذف</span></a></td> </tr><? } else {}?> this special member can delet his repllay and also delet member's repllays on his adv and also the member can delet only his reply it this code wright ?becouse it is not work Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 What does it do that's not right? Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 now i have 2 kind of members1- member 2- special memberspecial member can delet his repllay and other members replaies on only his advbut member can only delet his repllayplz corect the code to do that Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 All the code above does is print the delete links. If all you want to do is print the link for special members, wouldn't you just add an OR here to check if special is 2:if ($special == "1" AND $mem_id == $memberid){Or maybe you could just change that AND to an OR. Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 if i change AND to an OR. that will make special member delet his repllay and other members replaies in his subjects ??and also any member can delet his replayes ? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 It will do exactly what the if statement says:if ($special == "1" OR $mem_id == $memberid){If $special is 1, or if the member ID matches, then they can see the delete link. Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 i can see now the delet icone but when i push it don't delet the replay Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 i can't see code for delet replay from the table subject_replays Link to comment Share on other sites More sharing options...
masrawy Posted March 5, 2009 Author Share Posted March 5, 2009 this is delet code if ($action == "delete_subject") { $delete=mysql_query("DELETE from subject_replays WHERE id='$rep_id'"); if($delete){echo "تم الحذف بنجاح";} else {echo "هناك خطأ في عملية الحذف";}echo "<meta http-equiv=\"refresh\" content=\"2; URL=index.php?action=subject_disc&subjectid=$subjectid\">";}i need to the special only can delet his replay and other members replaybut member can only delet his replay not members replayes in his subject Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2009 Share Posted March 5, 2009 That code isn't checking any member IDs or anything, it's just checking if $action is "delete_subject". Is there code that checks the ID? Link to comment Share on other sites More sharing options...
masrawy Posted March 6, 2009 Author Share Posted March 6, 2009 no that is only i have Link to comment Share on other sites More sharing options...
justsomeguy Posted March 6, 2009 Share Posted March 6, 2009 Then according to what I see from the code, if the delete link is there it should delete, the code there is only checking if the delete link was there. Link to comment Share on other sites More sharing options...
masrawy Posted March 6, 2009 Author Share Posted March 6, 2009 this is the code of delet if ($action == "delete_subject") {$delete=mysql_query("DELETE from subject_replays WHERE id='$rep_id'");if($delete){echo "تم الحذف بنجاح";} else {echo "هناك خطأ في عملية الحذف";}echo "<meta http-equiv=\"refresh\" content=\"2; URL=index.php?action=subject_disc&subjectid=$subjectid\">";}so i need you to corect it sir Link to comment Share on other sites More sharing options...
justsomeguy Posted March 6, 2009 Share Posted March 6, 2009 You said it's not deleting when you click the link, right? The code you posted is saying to print a link like this:<a href="index.php?action=delete_subject&rep_id=...And the code to delete checks that:if ($action == "delete_subject") {...So according to the code, all you need in order to delete something is action=delete_subject on the link. If it's not deleting, the reason is in some other code that you haven't posted. Link to comment Share on other sites More sharing options...
masrawy Posted March 6, 2009 Author Share Posted March 6, 2009 how can i get it to you sir ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.