MySQL Forums
Forum List  »  PHP

Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Malajika,Active Church ,2018-07-21,7 Carter,12,12,12,12,12,12,12,12,12,12,12,12' at line 3
Posted by: Louie Malajika
Date: July 17, 2018 05:30AM

Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Malajika,Active Church ,2018-07-21,7 Carter,12,12,12,12,12,12,12,12,12,12,12,12' at line 3



<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {//Check it is comming from a form

//mysql credentials
define('DB_NAME', 'afm');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');


$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
// echo "<pre>";
// print_r($_POST); die();

//Output any connection error
if (!$link) {
die('Error :' . mysql_error());
}

$db_selected = mysql_select_db(DB_NAME, $link);

if (!$db_selected){
die('Error :' . DB_NAME . ': ' . mysql_error());
}

if(isset($_POST["submit"])){
$DEPUTY = $_POST['NAME_OF_DEPUTY_SHERHERD'];
$HOUSE_CHURCH = $_POST['NAME_OF_HOUSE_CHURCH'];
$meeting = $_POST['meetingDate'];
$ADD = $_POST['ADDRESS'];
// $value4 = $_POST['MEMBERS_PRESENT'];
$valu = $_POST['ADULTS_1'];
$val = $_POST['ADULTS_2'];
$va = $_POST['ADULTS_3'];
$v = $_POST['ADULTS_4'];
$vAD = $_POST['ADULTS_5'];
$vUL = $_POST['ADULTS_6'];
$vTS = $_POST['ADULTS_7'];
$vDS = $_POST['ADULTS_8'];
$vDST = $_POST['ADULTS_9'];
$VDSTV = $_POST['ADULTS_10'];
$vDSTVV = $_POST['ADULTS_11'];
$F = $_POST['ADULTS_12'];
$AAA = $_POST['ADULTS_13'];
$B = $_POST['ADULTS_14'];
$C = $_POST['ADULTS_15'];
$D = $_POST['ADULTS_16'];
// $value21 = $_POST['CHILDREN_ATTENDED'];
$E = $_POST['CHILDREN1'];
$G = $_POST['CHILDREN2'];
$H = $_POST['CHILDREN_3'];
$I = $_POST['CHILDREN_4'];
$J = $_POST['CHILDREN_5'];
$K = $_POST['CHILDREN_6'];
$L = $_POST['CHILDREN_7'];
$M = $_POST['CHILDREN_8'];
$O = $_POST['CHILDREN_9'];
$P = $_POST['CHILDREN_10'];
$Q = $_POST['CHILDREN_11'];
$R = $_POST['CHILDREN_12'];
$S = $_POST['CHILDREN_13'];
$T = $_POST['CHILDREN_14'];
$REASON = $_POST['ABSENTEES_AND_REASON'];
$EVERY = $_POST['DID_EVERY_MEMBER_DO_THEIR_DUTIES'];
$Z = $_POST['If_No'];
$X = $_POST['WAS_THE_PROGRAMME_FOLLOWED'];
$Y = $_POST['If_No_Why'];
$PROGRAMME = $_POST['WHAT_ITEM_OF_THE_PROGRAMME'];
$ITEM = $_POST['WHAT_ITEM_OF_THE_PROGRAMME_WAS_NOT'];
$RATE = $_POST['Rate'];
$WEW = $_POST['IF_YOU_RATED_IN_FROM_1_3'];
$EE = $_POST['V_I_P'];
$EEE = $_POST['A_PROFILE_OF_THE_V_I_P'];
$FF = $_POST['DID_YOU_CAST_THE_VISION'];
$SD = $_POST['IF_NO_WHY_NOT'];
$VG = $_POST['IF_YES_HOW_DID_YOU_DO_IT'];
$GG = $_POST['PASTOR_VILLAGE'];
$COMMENTS = $_POST['OTHER_COMMENTS'];
}

//$sql = "INSERT INTO church_report (NAME_OF_DEPUTY_SHERHERD) VALUES ('$value')";

$sql = "INSERT INTO church_report (NAME_OF_DEPUTY_SHERHERD, NAME_OF_HOUSE_CHURCH, meetingDate, ADDRESS, ADULTS_1, ADULTS_2, ADULTS_3, ADULTS_4, ADULTS_5, ADULTS_6, ADULTS_7, ADULTS_8, ADULTS_9, ADULTS_10, ADULTS_11, ADULTS_12, ADULTS_13, ADULTS_14, ADULTS_15, ADULTS_16, CHILDREN1, CHILDREN2, CHILDREN_3, CHILDREN_4, CHILDREN_5, CHILDREN_6, CHILDREN_7, CHILDREN_8,CHILDREN_9, CHILDREN_10, CHILDREN_11, CHILDREN_12, CHILDREN_13, CHILDREN_14, ABSENTEES_AND_REASON, DID_EVERY_MEMBER_DO_THEIR_DUTIES, If_No, WAS_THE_PROGRAMME_FOLLOWED, If_No_Why, WHAT_ITEM_OF_THE_PROGRAMME, WHAT_ITEM_OF_THE_PROGRAMME_WAS_NOT, Rate, IF_YOU_RATED_IN_FROM_1_3, V_I_P, A_PROFILE_OF_THE_V_I_P, DID_YOU_CAST_THE_VISION, IF_NO_WHY_NOT, IF_YES_HOW_DID_YOU_DO_IT,PASTOR_VILLAGE, OTHER_COMMENTS)

values ($DEPUTY,$HOUSE_CHURCH,$meeting,$ADD,$valu,$val,$va,$v,$vAD,$vUL,$vTS,$vDS,$vDST,$VDSTV,$vDSTVV,$F,$AAA,$B,$C,$D,$E,$G,$H,$I,$J,$K,$L,$M,$O,$P,$Q,$R,$S,$T,$REASON,$EVERY,$Z,$X,$Y,$PROGRAMME,$ITEM,$RATE,$WEW,$EE,$EEE,$FF,$SD,$VG,$GG,$COMMENTS)";
// $success = mysql_query($sql);

if (!mysql_query($sql)){
die('Error:' . mysql_error());
}

echo "AWE";


}
?>

Options: ReplyQuote


Subject
Written By
Posted
Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Malajika,Active Church ,2018-07-21,7 Carter,12,12,12,12,12,12,12,12,12,12,12,12' at line 3
July 17, 2018 05:30AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.