my code's
$output.= '<div class="body">'.$message.'</div>';
echo $output;//output the email body
include_once('simple_html_dom.php');
$html = str_get_html("$output");
foreach($html->find('tr') as $e) {
$b = $e->find('td',1)->plaintext;
$EMailArr[] =$b ;
}
$value_string3= implode("','", $EMailArr);
mysql_query("INSERT INTO test (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`) VALUES($value_string3)");
print "INSERT INTO test (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`) VALUES($value_string3)";
outputs.. Array
(
[0] => MD-MAL_MSAG5200_01 - MD-Malwana - ZTE
[1] => CRITICAL
[2] => MD-MAL_MSAG5200_01 - MD-Malwana - ZTE Isolated
[3] => All customers(49) in above MD-MAL_MSAG5200_01 DSLAM/=3D MSAN
[4] => PENDING
[5] => = FMT-BB(A)
[6] => OPEN
[7] => PENDING
[8] => Informed to DGM :idsmanjuka@gmail.com
)
INSERT INTO test (a
,b
,c
,d
,e
,f
,g
,h
,i
) VALUES(MD-MAL_MSAG5200_01 - MD-Malwana - ZTE',' CRITICAL','MD-MAL_MSAG5200_01 - MD-Malwana - ZTE Isolated','All customers(49) in above MD-MAL_MSAG5200_01 DSLAM/=3D MSAN ','PENDING','= FMT-BB(A)',' OPEN','PENDING','Informed to DGM :idsmanjuka@gmail.com )
Use backticks ` for your column names (as it contains space in it).
INSERT INTO test (`Network Affected`,`Fault Type`,`Fault Detail Description`,`Systems/Service
Affected`,`Expected Clearance`,`Fault Reported By`,`Fault Status`,`Fault Cleared Date`,`Details of
Actions Taken by FMT-BB`) VALUES ('MD-MAL_MSAG5200_01 - MD-Malwana - ZTE',' CRITICAL','MD-
MAL_MSAG5200_01 - MD-Malwana - ZTE Isolated','All customers(49) in above MD-
MAL_MSAG5200_01 DSLAM/=3D MSAN ','PENDING','= FMT-BB(A)',' OPEN','PENDING','Informed to
DGM :kapuru@slt.com.lk' )
Also as mention by @Harry in comment, make sure your string values are surrounded by '
Warning: It's a very poor practice to have column name with space.
Database and table names cannot contain /
, \
, .
, or characters that are not permitted in file names.
Database, table, and column names cannot end with space characters.
To know more about - http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
You are missing single quotes in some of your values (first and last). Also - the column names don't seem to by valid column names.
The correct syntax for INSERT statement is INSERT INTO TEST (column_name1,column_name2) VALUES ('value1','value2')
It seems that instead of column_name1 and column_name2 you are using column description.
Hope this helps!
INSERT INTO test( `Network Affected` , `Fault Type` , `Fault Detail Description` , `Systems/Service Affected` , `Expected Clearance` , `Fault Reported By` , `Fault Status` , `Fault Cleared Date` , `Details of Actions Taken by FMT-BB` )\VALUES ('MD-MAL_MSAG5200_01 - MD-Malwana - ZTE', ' CRITICAL', 'MD-MAL_MSAG5200_01 - MD-Malwana - ZTE Isolated', 'All customers(49) in above MD-MAL_MSAG5200_01 DSLAM/=3D MSAN ', 'PENDING', '= FMT-BB(A)', ' OPEN', 'PENDING', 'Informed to DGM :kapuru@slt.com.lk')
You are missing some backticks and single quotes. This should work.