Jump to content

Problem Of Sending Email To User


masrawy

Recommended Posts

  • Replies 304
  • Created
  • Last Reply

this is the code of mailsend<?ini_set("display_errors","1");ini_set("display_startup_errors","1");set_magic_quotes_runtime(0);include("include/dbcommon.php");// check if logged inif(!@$_SESSION["UserID"] || !CheckSecurity(@$_SESSION["OwnerID"],"Search")){ $_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"]; header("Location: login.php?message=expired"); return;}?><html dir="rtl"><meta http-equiv="Content-Language" content="en-us"><link href="include/style.css" rel="stylesheet" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"><?include("../system/config.php");$today_date = date ("Y-n-j");// START INSERT MSG$RegDate = date("Y-n-j"); if(!$_GET['begin']){ $begin= 0; $everytime = $_POST['everytime']; $time_every = $_POST['time_every']; $INSERTVALUES = mysql_query("INSERT INTO hendawy_cpmail(id,subject,activate,message,date) VALUES ('','$subject','$activate','$message','$today_date') "); } else{ $begin = $_GET['begin']; $everytime = $_GET['everytime']; $time_every = $_GET['time_every']; }// END INSERT MSG// START GET MSG$CheckUserC = mysql_query("SELECT * FROM hendawy_cpmail order by id desc limit 0,1");while($Row=mysql_fetch_array($CheckUserC)){ $lastid = $Row['id']; $subject = $Row['subject']; $activate = $Row['activate']; $message = $Row['message'];}//echo $lastid;// END GET MSG// START SEND$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=windows-1256' . "\r\n";$headers .= 'From: aljameela.net <info@aljameela.net>' . "\r\n";if($activate == "0"){$CheckUser = mysql_query("SELECT emial FROM mail_list LIMIT $begin,$everytime");$CheckUserN = mysql_query("SELECT id FROM mail_list");$field="emial";}if($activate == "1"){$CheckUser = mysql_query("SELECT email FROM members LIMIT $begin,$everytime");$CheckUserN = mysql_query("SELECT id FROM members");$field="email";}if($activate == "2"){$CheckUser = mysql_query("SELECT email FROM agents LIMIT $begin,$everytime");$CheckUserN = mysql_query("SELECT id FROM agents");$field="email";}$members_num = mysql_num_rows($CheckUserN);while($Row=mysql_fetch_array($CheckUser)) { $to = $Row[$field] ; @$mail_now = mail($to, $subject, $message, $headers); if($mail_now){echo "$to : تم الارسال بنجاح<br>";}else{echo "$to : <b><font color=red>فشل الارسال</font></b><br>";}} $begin2 = $begin + $everytime ;if($begin < $members_num){ $link = "mailsend.php?begin=$begin2&everytime=$everytime&time_every=$time_every"; echo "<meta http-equiv=refresh content=$time_every;URL=$link>";}else{ echo "<center><b>تم الانتهاء من ارسال جميع الرسائل وعددهم $members_num</b></center>"; echo '<br><center> <a href =menu.php>العودة للقائمة الرئيسية</a> </center>'; }// END SEND?>

Link to comment
Share on other sites

Every time you have a line that uses mysql_query, like this one:$CheckUserC = mysql_query("SELECT * FROM hendawy_cpmail order by id desc limit 0,1");change it to this:$CheckUserC = mysql_query("SELECT * FROM hendawy_cpmail order by id desc limit 0,1") or exit(mysql_error());e.g. change this:$INSERTVALUES = mysql_query("INSERT INTO hendawy_cpmail(id,subject,activate,message,date) VALUES ('','$subject','$activate','$message','$today_date') ");to this:$INSERTVALUES = mysql_query("INSERT INTO hendawy_cpmail(id,subject,activate,message,date) VALUES ('','$subject','$activate','$message','$today_date') ") or exit(mysql_error());etc

Link to comment
Share on other sites

It looks to me like you are using a Database name instead of a Table name in the Query.A table would *usually* not have the prefix and an underscore in it. What you used looks more like a Cpanel User-id with the DB name attached.

Link to comment
Share on other sites

Hi, that error means that the query doesn't find any "subject" column, there are some possible causes: - first the query is not calling the table that has the column, - much easier, the column exist but its name is misspell, - or the field doesn't exist at all in your db :) let us pray for the problem to be in the two first.hope this helps.

Link to comment
Share on other sites

hi, looking in code posted, your table "hendawy_cpmail" must have a "subject" field to be able to insert (i'm just guessing here)you should check your db for italso you could post the whole error you get, it would be very helpful

Link to comment
Share on other sites

Database soqmkac_soqTable structure for table admin_tableField Type Null Defaultid int(5) Yes NULLadminname varchar(100) Yes admin_pass varchar(30) Yes Table structure for table advsField Type Null Defaultid int(10) Yes NULLmem_id int(5) Yes 0fullname varchar(100) Yes NULLmobile varchar(100) Yes NULLemail varchar(100) Yes NULLurlsite varchar(250) Yes NULLimg varchar(250) Yes NULLadv_type varchar(250) Yes period int(5) Yes 0bank_name varchar(250) Yes date date Yes 0000-00-00account_owner mediumtext Yes NULLobserv mediumtext Yes NULLprice int(5) Yes 0activate enum('0', '1') Yes 0Table structure for table assessmentField Type Null Defaultid int(5) Yes NULLsubject_id int(5) Yes 0mem_id int(5) Yes 0assessment varchar(5) Yes Table structure for table assessment_fsField Type Null Defaultid int(5) Yes NULLfs_id int(5) Yes 0mem_id int(5) Yes 0assessment varchar(5) Yes Table structure for table call_usField Type Null Defaultid int(5) Yes NULLname varchar(250) Yes email varchar(250) Yes tel varchar(250) Yes title varchar(250) Yes subject mediumtext Yes NULLdate date Yes 0000-00-00active enum('0', '1') Yes 0Table structure for table catsField Type Null Defaultid int(10) Yes NULLcat_name varchar(200) Yes cat_disc mediumtext Yes NULLactive enum('0', '1') Yes 0Table structure for table countingField Type Null Defaulttimestamp int(15) Yes 0ip varchar(40) Yes file varchar(100) Yes mem enum('0', '1') Yes NULLTable structure for table countryField Type Null Defaultid int(5) Yes NULLcountry varchar(250) Yes NULLTable structure for table determine_advsField Type Null Defaultid int(10) Yes NULLmem_id int(5) Yes 0name varchar(100) Yes NULLmobile varchar(20) Yes NULLemail varchar(100) Yes NULLdetermine varchar(250) Yes period int(5) Yes 0subject_id int(5) Yes 0bank_name varchar(250) Yes edaaa_date date Yes 0000-00-00account_owner mediumtext Yes NULLobserv mediumtext Yes NULLprice int(10) Yes 0active enum('0', '1') Yes 0Table structure for table forumsField Type Null Defaultid int(10) Yes NULLmem_id int(10) Yes 0f_name varchar(250) Yes f_banner varchar(250) Yes f_email varchar(250) Yes f_disc mediumtext Yes NULLbasic_color varchar(50) Yes border_color varchar(50) Yes active enum('0', '1') Yes 0Table structure for table forum_subjectsField Type Null Defaultid int(10) Yes NULLmem_id int(10) Yes 0scountry int(5) Yes 0fs_name varchar(250) Yes fs_photo varchar(250) Yes fs_disc mediumtext Yes NULLadd_date date Yes 0000-00-00end_date date Yes 0000-00-00fs_time int(20) Yes 0active enum('0', '1') Yes 0count int(10) Yes 0Table structure for table fs_replaysField Type Null Defaultid int(10) Yes NULLfs_id int(10) Yes 0mem_id int(10) Yes 0replay mediumtext Yes NULLdate date Yes 0000-00-00active enum('0', '1') Yes 0Table 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 1Table structure for table j_nowField Type Null Defaultid int(10) Yes NULLtotal int(100) Yes 0v_date date Yes 0000-00-00Table structure for table mail_listField Type Null Defaultid int(10) Yes NULLemail varchar(250) Yes active enum('0', '1') Yes 0active_code int(10) Yes 0Table structure for table membersField Type Null Defaultid int(10) Yes NULLname varchar(100) Yes NULLcountry varchar(100) Yes NULLcity varchar(100) Yes NULLday int(5) Yes 0month int(5) Yes 0birth int(5) Yes NULLemail varchar(100) Yes NULLemail_case enum('0', '1') Yes 0mobile1 varchar(100) Yes NULLtel varchar(50) Yes another_ways mediumtext Yes NULLpassword varchar(100) Yes NULLfullname varchar(250) Yes vv varchar(5) Yes education varchar(250) Yes date date Yes 0000-00-00special enum('0', '1') Yes 0active enum('0', '1') Yes 0active_code int(10) Yes 0Table structure for table mstaml_advsField Type Null Defaultid int(5) Yes NULLadvs_name varchar(250) Yes advs_short mediumtext Yes NULLadvs mediumtext Yes NULLadvs_page varchar(250) Yes active enum('0', '1') Yes 0Table structure for table mtajerField Type Null Defaultid int(10) Yes NULLmem_id int(10) Yes 0m_name varchar(250) Yes m_photo varchar(250) Yes email varchar(250) Yes m_disc mediumtext Yes NULLactive enum('0', '1') Yes 0Table structure for table pagesField Type Null Defaultid int(10) Yes NULLurl varchar(250) Yes active enum('0', '1') Yes 0Table structure for table preferredField Type Null Defaultid int(5) Yes NULLmem_id int(5) Yes 0cat_id int(5) Yes 0subject_id int(5) Yes 0country varchar(200) Yes active enum('0', '1') Yes 0Table structure for table preferred_fsField Type Null Defaultid int(5) Yes NULLmem_id int(5) Yes 0fs_id int(5) Yes 0country varchar(200) Yes active enum('0', '1') Yes 0Table structure for table random_photoField Type Null Defaultid int(10) Yes NULLphoto varchar(250) Yes url varchar(250) Yes active enum('0', '1') Yes 0Table structure for table repeat_quesField Type Null Defaultid int(10) Yes NULLques varchar(250) Yes disc mediumtext Yes NULLactive enum('0', '1') Yes 0Table structure for table special_memberField Type Null Defaultid int(10) Yes NULLmem_id int(5) Yes 0name varchar(100) Yes NULLmobile varchar(20) Yes NULLemail varchar(100) Yes NULLperiod int(5) Yes 0bank_name varchar(250) Yes edaaa_date date Yes 0000-00-00account_owner mediumtext Yes NULLobserv mediumtext Yes NULLprice int(10) Yes 0active enum('0', '1') Yes 0Table structure for table ssubjectField Type Null Defaultid int(10) Yes NULLcat_id int(10) Yes 0mem_id int(10) Yes 0scountry int(5) Yes 0offer_request enum('0', '1') Yes 0s_name varchar(250) Yes s_photo varchar(250) Yes s_disc mediumtext Yes NULLheight_adv enum('0', '1') Yes 0first_page enum('0', '1') Yes 0inside_page enum('0', '1') Yes 0start_date date Yes 0000-00-00end_date date Yes 0000-00-00sub_time int(20) Yes 0replay enum('1', '0') Yes 1active enum('0', '1') Yes 0count int(10) Yes 0Table structure for table stylField Type Null Defaultid int(11) Yes NULLstyl varchar(30) Yes name varchar(150) Yes Table structure for table styl_settingField Type Null Defaultstyl int(10) Yes 0Table structure for table subject_replaysField Type Null Defaultid int(10) Yes NULLsubject_id int(10) Yes 0mem_id int(10) Yes 0replay mediumtext Yes NULLdate date Yes 0000-00-00active enum('0', '1') Yes 0

Link to comment
Share on other sites

Database soqmkac_soqTable 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 1
subject,activate,message,dateThere are no any of these fields in your tableYou will have to log in to your cPanel > phpmyadmin and add these fields to hendawy_mail table
Link to comment
Share on other sites

i did sir and this eroor comemysql_fetch_array(): supplied argument is not a valid MySQL result resourcesoqmka.com/cp/mailsend.php?home/soqmkac/public_html/cp/mailsend.phpline 43what can i do
Have you changed hendawy_cpmail to hendawy_mail, like here:// START GET MSG$CheckUserC = mysql_query("SELECT * FROM hendawy_cpmail order by id desc limit 0,1");Double check ...
Link to comment
Share on other sites

Look at this statement:$INSERTVALUES = mysql_query("INSERT INTO hendawy_cpmail(id,subject,activate,message,date) VALUES ...That's trying to insert a record into a table called hendawy_cpmail. You don't have a table called hendawy_cpmail. You have a table called hendawy_mail, but not hendawy_cpmail. It's also trying to use columns called subject, activate, message, and date. The hendawy_mail table does not have fields called "subject", "activate", or "message". It does have a "date" field though.In terms of a solution, that's up to you. You can change the PHP code to use the hendawy_mail table with its fields instead of hendawy_cpmail, or you can add a hendawy_cpmail table to the database with the correct fields in it. I can't tell you which of those is the right answer because I don't know what you're using these tables for and if you need a new table or if the code is incorrect. You'll have to make a decision whether you want to change the code or add a table.

Link to comment
Share on other sites

i chang table hendawy_cpmail to hendawy_mailand add the table of subject,activate,message,datethis mesage come to memysql_fetch_array(): supplied argument is not a valid MySQL result resourcesoqmka.com/cp/mailsend.php?home/soqmkac/public_html/cp/mailsend.phpline 43

Link to comment
Share on other sites

i chang table hendawy_cpmail to hendawy_mail........line 43
Ohh?Where did you changed it?Why don't you add this at the start of mailsend.phperror_reporting(E_ALL);ini_set('html_errors', 1);ini_set('log_errors', 0);ini_set('display_errors', 1); And also:
Every time you have a line that uses mysql_query, like this one:$CheckUserC = mysql_query("SELECT * FROM hendawy_cpmail order by id desc limit 0,1");change it to this:$CheckUserC = mysql_query("SELECT * FROM hendawy_cpmail order by id desc limit 0,1") or exit(mysql_error());e.g. change this:$INSERTVALUES = mysql_query("INSERT INTO hendawy_cpmail(id,subject,activate,message,date) VALUES ('','$subject','$activate','$message','$today_date') ");to this:$INSERTVALUES = mysql_query("INSERT INTO hendawy_cpmail(id,subject,activate,message,date) VALUES ('','$subject','$activate','$message','$today_date') ") or exit(mysql_error());etc
Also there is a spelling error hereif($activate == "0"){$CheckUser = mysql_query("SELECT emial FROM mail_list LIMIT $begin,$everytime");$CheckUserN = mysql_query("SELECT id FROM mail_list");$field="emial";}Change emial to emailAfter you do that, post your mailsend.php again here ..
Link to comment
Share on other sites

i really thank the 2 members who help me and i ask for another error whene the member put article and need to delet it he do deletbut in my script any one can delet by putting url for deletthis is the code if ($action == "delete_adv") {br(); br();echo "<center><font size=4 face=\"Traditional Arabic\"><b>حذف إعلان</b></font></center>";br(); br();echo "<p align=right><font size=2 color=#FF0000><b>   </b></font></p>"; $delete=mysql_query("DELETE from ssubject WHERE id='$sid'"); if($delete){echo "تم الحذف بنجاح";} else {echo "هناك خطأ في عملية الحذف";}echo "<meta http-equiv=\"refresh\" content=\"0; URL=index.php\">";}ehat can i do to only the member delet him article onlythank you

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...