Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

SQL error

Codes here !

Moderators: macek, egami, gesf

SQL error

Postby syntaxerror286 » Mon Sep 24, 2012 8:32 pm

I've created 4 form that will be stored in one table. I'm attaching my form. It appears "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 ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)' at line 1". I'm still searching for the solution. Tq for your help.. our help...

Butiran_Peribadi


<?php

session_start();

session_register('no_kp_pemohon');
session_register('nama_penuh');
session_register('tarikh_lahir');
session_register('jantina');
session_register('tarikh_perkahwinan');
session_register('status_kewarganegaraan');
session_register('no_hp');
session_register('emel');
session_register('alamat_tetap_b1');
session_register('alamat_tetap_b2');
session_register('bandar_tetap');
session_register('poskod_tetap');
session_register('negeri_tetap');
session_register('alamat_sm_b1');
session_register('alamat_sm_b2');
session_register('bandar_sm');
session_register('poskod_sm');
session_register('negeri_sm');
session_register('telefon_rumah');

$_SESSION['no_kp_pemohon'] = $_POST['no_kp_pemohon'];
$_SESSION['nama_penuh'] = $_POST['nama_penuh'];
$_SESSION['tarikh_lahir'] = $_POST['tarikh_lahir'];
$_SESSION['jantina'] = $_POST['jantina'];
$_SESSION['tarikh_perkahwinan'] = $_POST['tarikh_perkahwinan'];
$_SESSION['status_kewarganegaraan'] = $_POST['status_kewarganegaraan'];
$_SESSION['no_hp'] = $_POST['no_hp'];
$_SESSION['emel'] = $_POST['emel'];
$_SESSION['alamat_tetap_b1'] = $_POST['alamat_tetap_b1'];
$_SESSION['alamat_tetap_b2'] = $_POST['alamat_tetap_b2'];
$_SESSION['bandar_tetap'] = $_POST['bandar_tetap'];
$_SESSION['poskod_tetap'] = $_POST['poskod_tetap'];
$_SESSION['negeri_tetap'] = $_POST['negeri_tetap'];
$_SESSION['alamat_sm_b1'] = $_POST['alamat_sm_b1'];
$_SESSION['alamat_sm_b2'] = $_POST['alamat_sm_b2'];
$_SESSION['bandar_sm'] = $_POST['bandar_sm'];
$_SESSION['poskod_sm'] = $_POST['poskod_sm'];
$_SESSION['negeri_sm'] = $_POST['negeri_sm'];
$_SESSION['telefon_rumah'] = $_POST['telefon_rumah'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Butiran Peribadi</title>
<style type="text/css">
<!--
.style18 {font-size: 12px; font-family: Tahoma;}
-->
</style>
</head>

<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="butiran_penjaga.php">
<table width="585" border="1" align="center">
<tr>
<td width="575"><table width="582" border="1">
<tr>
<td width="251">&nbsp;</td>
<td width="308">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><table width="580" border="1">
<tr>
<td width="252" class="style18">No. Kad Pengenalan</td>
<td width="312"><input type="text" name="no_kp_pemohon" id="no_kp_pemohon" /></td>
</tr>
<tr>
<td><span class="style18">Nama Penuh (Seperti di dalam MYKAD)</span></td>
<td><input type="text" name="nama_penuh" id="nama_penuh" /></td>
</tr>
<tr>
<td><span class="style18">Tarikh Lahir</span></td>
<td><input type="text" name="tarikh_lahir" id="tarikh_lahir" /></td>
</tr>
<tr>
<td><span class="style18">Jantina</span></td>
<td><input type="text" name="jantina" id="jantina" /></td>
</tr>
<tr>
<td><span class="style18">Taraf Perkahwinan</span></td>
<td><input type="text" name="taraf_perkahwinan" id="taraf_perkahwinan" /></td>
</tr>
<tr>
<td><span class="style18">Status Kewarganegaraan</span></td>
<td><input type="text" name="status_kewarganegaraan" id="status_kewarganegaraan" /></td>
</tr>
<tr>
<td><span class="style18">No. Telefon Bimbit (Untuk Dihubungi)</span></td>
<td><input type="text" name="no_hp" id="no_hp" /></td>
</tr>
<tr>
<td><span class="style18">E-mel</span></td>
<td><input type="text" name="emel" id="emel" /></td>
</tr>
<tr>
<td><span class="style18">Alamat Tetap (Seperti di dalam MYKAD)</span></td>
<td><input type="text" name="alamat_tetap_b1" id="alamat_tetap_b1" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="text" name="alamat_tetap_b2" id="alamat_tetap_b2" /></td>
</tr>
<tr>
<td><span class="style18">Bandar</span></td>
<td><input type="text" name="bandar_tetap" id="bandar_tetap" /></td>
</tr>
<tr>
<td><span class="style18">Poskod</span></td>
<td><input type="text" name="poskod_tetap" id="poskod_tetap" /></td>
</tr>
<tr>
<td><span class="style18">Negeri</span></td>
<td><input type="text" name="negeri_tetap" id="negeri_tetap" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style18">Alamat Surat Menyurat</span></td>
<td><input type="text" name="alamat_sm_b1" id="alamat_sm_b1" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="text" name="alamat_sm_b2" id="alamat_sm_b2" /></td>
</tr>
<tr>
<td><span class="style18">Bandar</span></td>
<td><input type="text" name="bandar_sm" id="bandar_sm" /></td>
</tr>
<tr>
<td><span class="style18">Poskod</span></td>
<td><input type="text" name="poskod_sm" id="poskod_sm" /></td>
</tr>
<tr>
<td><span class="style18">Negeri</span></td>
<td><input type="text" name="negeri_sm" id="negeri_sm" /></td>
</tr>
<tr>
<td><span class="style18">No. Telefon Rumah (Untuk Dihubungi)</span></td>
<td><input type="text" name="telefon_rumah" id="telefon_rumah" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Seterusnya" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html>

----- end page-----



Butiran_Penjaga

<?php

session_start();

session_register('nama_penjaga');
session_register('hubungan_penjaga');
session_register('pekerjaan_penjaga');
session_register('p_bulanan_penjaga');
session_register('alamat_waris_b1');
session_register('alamat_waris_b2');
session_register('bandar');
session_register('poskod');
session_register('negeri');
session_register('telefon_rumah_penjaga');

$_SESSION['nama_penjaga'] = $_POST['nama_penjaga'];
$_SESSION['hubungan_penjaga'] = $_POST['hubungan_penjaga'];
$_SESSION['pekerjaan_penjaga'] = $_POST['pekerjaan_penjaga'];
$_SESSION['p_bulanan_penjaga'] = $_POST['p_bulanan_penjaga'];
$_SESSION['alamat_waris_b1'] = $_POST['alamat_waris_b1'];
$_SESSION['alamat_waris_b2'] = $_POST['alamat_waris_b2'];
$_SESSION['bandar'] = $_POST['bandar'];
$_SESSION['poskod'] = $_POST['poskod'];
$_SESSION['negeri'] = $_POST['negeri'];
$_SESSION['telefon_rumah_penjaga'] = $_POST['telefon_rumah_penjaga'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Butiran Peribadi</title>
<style type="text/css">
<!--
.style18 {font-size: 12px; font-family: Tahoma;}
-->
</style>
</head>

<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="butiran_keputusan_percubaan_spm.php">
<table width="585" border="1" align="center">
<tr>
<td width="575"><table width="582" border="1">
<tr>
<td width="251">&nbsp;</td>
<td width="308">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><table width="580" border="1">
<tr>
<td width="264" class="style18">Nama Penuh Penjaga (Seperti di dalam MYKAD)</td>
<td width="300"><input type="text" name="nama_penjaga" id="nama_penjaga" /></td>
</tr>
<tr>
<td><span class="style18">Hubungan Penjaga</span></td>
<td><input type="text" name="hubungan_penjaga" id="hubungan_penjaga" /></td>
</tr>
<tr>
<td><span class="style18">Pekerjaan Penjaga</span></td>
<td><input type="text" name="pekerjaan_penjaga" id="pekerjaan_penjaga" /></td>
</tr>
<tr>
<td><span class="style18">Pendapatan Bulanan</span></td>
<td><input type="text" name="p_bulanan_penjaga" id="p_bulanan_penjaga" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style18">Alamat Tetap Waris (Seperti di dalam MYKAD)</span></td>
<td><input type="text" name="alamat_waris_b1" id="alamat_waris_b1" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="text" name="alamat_waris_b2" id="alamat_waris_b2" /></td>
</tr>
<tr>
<td><span class="style18">Bandar</span></td>
<td><input type="text" name="bandar" id="bandar" /></td>
</tr>
<tr>
<td><span class="style18">Poskod</span></td>
<td><input type="text" name="poskod" id="poskod" /></td>
</tr>
<tr>
<td><span class="style18">Negeri</span></td>
<td><input type="text" name="negeri" id="negeri" /></td>
</tr>
<tr>
<td><span class="style18">No. Telefon Rumah (Untuk Dihubungi)</span></td>
<td><input type="text" name="telefon_rumah_penjaga_penjaga" id="telefon_rumah_penjaga_penjaga" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Seterusnya" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html>

----- end page ------


butiran_keputusan_percubaan_spm


<?php

session_start();

session_register('nama_sekolah');
session_register('kep_bm');
session_register('kep_bi');
session_register('kep_mat');
session_register('kep_sejarah');
session_register('kep_PI');
session_register('kep_fizik');
session_register('kep_kimia');
session_register('kep_bio');
session_register('kep_sains');
session_register('mp1');
session_register('keputusan_mp1');
session_register('mp2');
session_register('keputusan_mp2');
session_register('mp3');
session_register('keputusan_mp3');
session_register('mp4');
session_register('keputusan_mp4');
session_register('mp5');
session_register('keputusan_mp5');
session_register('mp6');
session_register('keputusan_mp6');
session_register('mp7');
session_register('keputusan_mp7');

$_SESSION['nama_sekolah'] = $_POST['nama_sekolah'];
$_SESSION['kep_bm'] = $_POST['kep_bm'];
$_SESSION['kep_bi'] = $_POST['kep_bi'];
$_SESSION['kep_mat'] = $_POST['kep_mat'];
$_SESSION['kep_sejarah'] = $_POST['kep_sejarah'];
$_SESSION['kep_PI'] = $_POST['kep_PI'];
$_SESSION['kep_fizik'] = $_POST['kep_fizik'];
$_SESSION['kep_kimia'] = $_POST['kep_kimia'];
$_SESSION['kep_bio'] = $_POST['kep_bio'];
$_SESSION['kep_sains'] = $_POST['kep_sains'];
$_SESSION['mp1'] = $_POST['mp1'];
$_SESSION['keputusan_mp1'] = $_POST['keputusan_mp1'];
$_SESSION['mp2'] = $_POST['mp2'];
$_SESSION['keputusan_mp2'] = $_POST['keputusan_mp2'];
$_SESSION['mp3'] = $_POST['mp3'];
$_SESSION['keputusan_mp3'] = $_POST['keputusan_mp3'];
$_SESSION['mp4'] = $_POST['mp4'];
$_SESSION['keputusan_mp4'] = $_POST['keputusan_mp4'];
$_SESSION['mp5'] = $_POST['mp5'];
$_SESSION['keputusan_mp5'] = $_POST['keputusan_mp5'];
$_SESSION['mp6'] = $_POST['mp6'];
$_SESSION['keputusan_mp6'] = $_POST['keputusan_mp6'];
$_SESSION['mp7'] = $_POST['mp7'];
$_SESSION['keputusan_mp7'] = $_POST['keputusan_mp7'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Butiran Keputusan Percubaan SPM</title>
<style type="text/css">
<!--
.style18 {font-size: 12px; font-family: Tahoma;}
-->
</style>
</head>

<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="akuan.php">
<table width="585" border="1" align="center">
<tr>
<td width="575"><table width="582" border="1">
<tr>
<td width="251">&nbsp;</td>
<td width="308">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><table width="580" border="1">
<tr>
<td width="252" class="style18">Nama Sekolah</td>
<td width="312"><input type="text" name="nama_sekolah" id="nama_sekolah" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran Asas</span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style18">Bahasa Melayu</span></td>
<td><input type="text" name="kep_bm" id="kep_bm" /></td>
</tr>
<tr>
<td><span class="style18">Bahasa Inggeris</span></td>
<td><input type="text" name="kep_bi" id="kep_bi" /></td>
</tr>
<tr>
<td><span class="style18">Matematik</span></td>
<td><input type="text" name="kep_mat" id="kep_mat" /></td>
</tr>
<tr>
<td><span class="style18">Sejarah</span></td>
<td><input type="text" name="kep_sejarah" id="kep_sejarah" /></td>
</tr>
<tr>
<td><span class="style18">Pendidikan Islam</span></td>
<td><input type="text" name="kep_PI" id="kep_PI" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style18">Fizik</span></td>
<td><input type="text" name="kep_fizik" id="kep_fizik" /></td>
</tr>
<tr>
<td><span class="style18">Kimia</span></td>
<td><input type="text" name="kep_kimia" id="kep_kimia" /></td>
</tr>
<tr>
<td><span class="style18">Biologi</span></td>
<td><input type="text" name="kep_bio" id="kep_bio" /></td>
</tr>
<tr>
<td><span class="style18">Sains</span></td>
<td><input type="text" name="kep_sains" id="kep_sains" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp1" id="mp1" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp1" id="keputusan_mp1" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp2" id="mp2" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp2" id="keputusan_mp2" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp3" id="mp3" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp3" id="keputusan_mp3" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp4" id="mp4" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp4" id="keputusan_mp4" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp5" id="mp5" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp5" id="keputusan_mp5" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp6" id="mp6" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp6" id="keputusan_mp6" /></td>
</tr>
<tr>
<td><span class="style18">Mata Pelajaran</span></td>
<td><input type="text" name="mp7" id="mp7" /></td>
</tr>
<tr>
<td><span class="style18">Keputusan</span></td>
<td><input type="text" name="keputusan_mp7" id="keputusan_mp7" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Seterusnya" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html>

------ end----




akuan

<?php

session_start();

session_register('pakej_pengajian');
session_register('punca_maklumat');
session_register('lain_lain');
session_register('kawan_perkenal_program');
session_register('penyakit_kritikal');
session_register('kecacatan');
session_register('checkbox');


$_SESSION['pakej_pengajian'] = $_POST['pakej_pengajian'];
$_SESSION['punca_maklumat'] = $_POST['punca_maklumat'];
$_SESSION['lain_lain'] = $_POST['lain_lain'];
$_SESSION['kawan_perkenal_program'] = $_POST['kawan_perkenal_program'];
$_SESSION['penyakit_kritikal'] = $_POST['penyakit_kritikal'];
$_SESSION['kecacatan'] = $_POST['kecacatan'];
$_SESSION['checkbox'] = $_POST['checkbox'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Butiran Akuan</title>
<style type="text/css">
<!--
.style18 {font-size: 12px; font-family: Tahoma;}
.style4 {font-family: Tahoma; font-size: 10px; }
-->
</style>
</head>

<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="insert.php">
<table width="727" border="1" align="center">
<tr>
<td width="717"><table width="582" border="1">
<tr>
<td width="251">&nbsp;</td>
<td width="308">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><table width="716" border="1">
<tr>
<td width="302" class="style18">Pakej Pengajian</td>
<td width="398"><input type="text" name="pakej_pengajian" id="pakej_pengajian" /></td>
</tr>
<tr>
<td><span class="style18">Bagaimana anda mendapat maklumat mengenai program ini?</span></td>
<td><input type="text" name="punca_maklumat" id="punca_maklumat" /></td>
</tr>
<tr>
<td><span class="style18">Lain - lain</span></td>
<td><input type="text" name="lain_lain" id="lain_lain" /></td>
</tr>
<tr>
<td><span class="style18">Nama rakan / pelajar UTHM yang memperkenalkan program ini</span></td>
<td><input type="text" name="kawan_perkenal_program" id="kawan_perkenal_program" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style18">Penyakit Kritikal</span></td>
<td><input type="text" name="penyakit_kritikal" id="penyakit_kritikal" /></td>
</tr>
<tr>
<td><span class="style18">Kecacatan</span></td>
<td><input type="text" name="kecacatan" id="kecacatan" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><span class="style18">Akuan</span></td>
<td><span class="style4">
<input type="checkbox" name="checkbox" value="Y" <?php if( isset( $_GET['checkbox'] ) ){ ?> checked="checked" <?php } ?> />
Saya mengaku bahawa semua maklumat yang diberi di atas adalah benar.</span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Seterusnya" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html>

----- end----



insert (insert into database)

<?php

session_start();
include('connection.php');
$query = "INSERT INTO pra_diploma_data (no_kp_pemohon, nama_penuh, tarikh_lahir, jantina, taraf_perkahwinan, status_kewarganegaraan, no_hp, emel, alamat_tetap_b1, alamat_tetap_b2, bandar_tetap, poskod_tetap,negeri_tetap,alamat_sm_b1,alamat_sm_b2,bandar_sm,poskod_sm,negeri_sm,telefon_rumah,nama_penjaga,hubungan_penjaga,pekerjaan_penjaga,p_bulanan_penjaga,alamat_waris_b1,alamat_waris_b2,bandar,poskod,negeri,telefon_rumah_penjaga,nama_sekolah,kep_bm,kep_bi,kep_mat,kep_sejarah,kep_PI,kep_fizik,kep_kimia,kep_bio,mp1,keputusan_mp1,mp2,keputusan_mp2,mp3,keputusan_mp3,mp4,keputusan_mp4,mp5,keputusan_mp5,mp6,keputusan_mp6,mp7,keputusan_mp7,pakej_pengajian,punca_maklumat,lain_lain,kawan_perkenal_program,hp_kawan_perkenal_program,penyakit_kritikal,kecacatan,akuan) VALUES (" . $_SESSION['no_kp_pemohon'] . "," . $_SESSION['nama_penuh'] . "," . $_SESSION['tarikh_lahir'] . "," . $_SESSION['jantina'] . "," . $_SESSION['taraf_perkahwinan'] . "," . $_SESSION['status_kewarganegaraan'] . "," . $_SESSION['no_hp'] . "," . $_SESSION['emel'] . "," . $_SESSION['alamat_tetap_b1'] . "," . $_SESSION['alamat_tetap_b2'] . "," . $_SESSION['bandar_tetap'] . "," . $_SESSION['poskod_tetap'] . "," . $_SESSION['negeri_tetap'] . "," . $_SESSION['alamat_smb1'] . "," . $_SESSION['alamat_smb2'] . "," . $_SESSION['bandar_sm'] . "," . $_SESSION['poskod_sm'] . "," . $_SESSION['negeri_sm'] . "," . $_SESSION['telefon_rumah'] . "," . $_SESSION['nama_penjaga'] . "," . $_SESSION['hubungan_penjaga'] . "," . $_SESSION['pekerjaan_penjaga'] . "," . $_SESSION['p_bulanan_penjaga'] . "," . $_SESSION['alamat_waris_b1'] . "," . $_SESSION['alamat_waris_b2'] . "," . $_SESSION['bandar'] . "," . $_SESSION['poskod'] . "," . $_SESSION['negeri'] . "," . $_SESSION['telefon_rumah_penjaga'] . "," . $_SESSION['nama_sekolah'] . "," . $_SESSION['kep_bm'] . "," . $_SESSION['kep_bi'] . "," . $_SESSION['kep_mat'] . "," . $_SESSION['kep_sejarah'] . "," . $_SESSION['kep_PI'] . "," . $_SESSION['kep_fizik'] . "," . $_SESSION['kep_kimia'] . "," . $_SESSION['kep_bio'] . "," . $_SESSION['mp1'] . "," . $_SESSION['keputusan_mp1'] . "," . $_SESSION['mp2'] . "," . $_SESSION['keputusan_mp2'] . "," . $_SESSION['mp3'] . "," . $_SESSION['keputusan_mp3'] . "," . $_SESSION['mp4'] . "," . $_SESSION['keputusan_mp4'] . "," . $_SESSION['mp5'] . "," . $_SESSION['keputusan_mp5'] . "," . $_SESSION['mp6'] . "," . $_SESSION['keputusan_mp6'] . "," . $_SESSION['mp7'] . "," . $_SESSION['keputusan_mp7'] . "," . $_SESSION['pakej_pengajian'] . "," . $_SESSION['punca_maklumat'] . "," . $_SESSION['lain_lain'] . "," . $_SESSION['kawan_perkenal_program'] . "," . $_SESSION['hp_kawan_perkenal_program'] . "," . $_SESSION['penyakit_kritikal'] . "," . $_SESSION['kecacatan'] . "," . $_SESSION['checkbox'] . ",)";

$result = mysql_query($query)or die(mysql_error());

----- end-----
syntaxerror286
New php-forum User
New php-forum User
 
Posts: 7
Joined: Wed Apr 11, 2012 11:50 pm

Re: SQL error

Postby engrmudasirmalik » Thu Oct 04, 2012 10:09 pm

No one would be able to know if you want to ask something or you wanted to tell something. Second thing is that you will never be able to get the answer of this untill you have not placed your codes into verified form.
So please make it clean and neat.
User avatar
engrmudasirmalik
New php-forum User
New php-forum User
 
Posts: 14
Joined: Wed Jan 11, 2012 11:39 am
Location: Bahawalpur Pakistan

Re: SQL error

Postby seandisanti » Fri Oct 05, 2012 8:09 am

here's what the error means.

1) it's output of an sql error, so sql is being executed.
2) it's saying there's a syntax error by a long series of commas

While you don't have a long sequence of commas, you do have a VALUES(...) in your query populated with a comma delimited list of session variables. why don't you echo your $query prior to passing it to the database and I think you'll see what the error is saying.

Then you just need to ask yourself why so many session variables are empty, and where those session variables are actually being populated, and how do you want to make sure they're set or not empty prior to creating your query string.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron