Jump to content

Parse error: parse error, expecting `'{'' in D:\xampplite\htdocs\Peperiksaan\sample code\samplecode2\wda2-winestore\includes\template.inc on line 28


sueirnaa

Recommended Posts

when i put code error reporting..ohw god..so many errorsNotice: Use of undefined constant localhost - assumed 'localhost' in C:\xampplite\htdocs\Login\peperiksaan\add-delete-update\config.php on line 11Notice: Use of undefined constant Nama - assumed 'Nama' in C:\xampplite\htdocs\Login\peperiksaan\add-delete-update\view.php on line 44wht should i do, how to defined constant localhost & others...sorry..im a beginner...

Link to comment
Share on other sites

Are you putting quotation marks around those values?

Link to comment
Share on other sites

Are you putting quotation marks around those values?
yup..error msg :Notice: Undefined index: update in D:\xampplite\htdocs\Login\peperiksaan\add-delete-update\update.php on line 4 Notice: Undefined index: msg in D:\xampplite\htdocs\Login\peperiksaan\add-delete-update\update.php on line 49how to define index...wht should i do?can someone show me?update.php<?phpinclude_once ("config.php");if($_GET['update']){//$PengawasID = mysql_real_escape_string($_POST['PengawasID']);$Nama = mysql_real_escape_string($_POST['Nama']);$KP = mysql_real_escape_string($_POST['KP']);$Jawatan = mysql_real_escape_string($_POST['Jawatan']);$Gred = mysql_real_escape_string($_POST['Gred']);$Tlantik = mysql_real_escape_string($_POST['Tlantik']);$Tsah = mysql_real_escape_string($_POST['Tsah']);$alamat = mysql_real_escape_string($_POST['alamat']);$poskod = mysql_real_escape_string($_POST['poskod']);$bandar = mysql_real_escape_string($_POST['bandar']);$notel = mysql_real_escape_string($_POST['notel']);$nofax = mysql_real_escape_string($_POST['nofax']);$nohp1 = mysql_real_escape_string($_POST['nohp1']);$query = mysql_query("UPDATE pengawas SET `Nama`= '$Name', `kp`= '$KP',`Jawatan`='$jawatan', `Gred`='$gred', `Tlantik`='$lantik1', `Tsah`= '$sah1',`alamat`= '$alamat', `poskod`= '$poskod', `notel`= '$notel', `nofax`= '$notelp', `nohp1`= '$hp'")or die('Error : ' . mysql_error()); header("Location: update.php?PengawasID=$PengawasID&msg=done"); exit;}?><!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=iso-8859-1" /><title>DBexam</title><style type="text/css"><!--.style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}.style2 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; color: #333333;}--></style></head><body><h2 align="center" class="style2">Kemaskini Maklumat Pengawas </h2><p><?phpif ($_GET['msg']){ echo "<p style=\"color:#FF0000\"><strong>Your content has been updated!</strong></p>";}$show = "SELECT * FROM pengawas WHERE PengawasID='$_GET[PengawasID]'";$result = mysql_query($show);while ($show = mysql_fetch_array ($result)){//$PengawasID = $show['PengawasID'];$Name = $show['Nama'];$kp = $show['KP'];$jawatan = $show['Jawatan'];$gred = $show['Gred'];$lantik1 = $show['Tlantik'];$sah1 = $show['Tsah'];$alamat = $show['alamat'];$poskod = $show['poskod'];$bandar = $show['bandar'];$notel = $show['notel'];$notelp = $show['nofax'];$hp = $show['nohp1'];}?><form action="update.php?update=yes" method="post"> <table width="99%" border="0" cellspacing="1" cellpadding="1"> <tr> <th width="34%" class="text" scope="row"><div align="left" class="style1">Nama:</div></th> <td width="66%"> <input name="name" type="text" id="name" value="<?php echo $Name; ?>"/> </td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">No.Kad Pengenalan :</div></th> <td><input name="kp" type="text" value="<?php echo $KP; ?>" /> <label></label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">Jawatan : </div></th> <td><label> <input name="jawatan" type="text" id="jawatan" value="<?php echo $Jawatan;?>" /> </label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">Gred Jawatan </div></th> <td><label> <input name="gred" type="text" value="<?php echo $Gred;?>" /> </label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">Tarikh dilantik ke jawatan sekarang : </div></th> <td><label> <input name="lantik1" type="text" value="<?php echo $Tlantik;?>" /> </label> <label></label> <label></label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">Tarikh disahkan ke jawatan sekarang :</div></th> <td><label> <input name="sah1" type="text" value="<?php echo $Tsah;?>" /> </label> <label></label> <label></label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">Alamat tempat bertugas : </div></th> <td><label> <input name="alamat" type="text" value="<?php echo $alamat;?>" /> Poskod <input name="poskod" type="text" value="<?php echo $poskod;?>" /> Bandar : <input name="bandar" type="text" value="<?php echo $$bandar;?>" /></label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">No Telefon Pejabat : </div></th> <td><label> <input name="notel" type="text" value="<?php echo $notel;?>" /> </label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">No Faks Pejabat : </div></th> <td><label> <input name="notelp" type="text" value="<?php echo $nofax;?>" /> </label></td> </tr> <tr> <th class="text" scope="row"><div align="left" class="style1">No Telefon Bimbit : </div></th> <td><label> <input name="textfield16" value="<?php echo $nohp1;?>" /> </label></td> </tr> <tr> <th scope="row"> </th> <td><input type="submit" name="Submit" value="Update" /> <input type="hidden" value="<?php echo $PengawasID; ?>" name="PengawasID"> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr></table></form><p> </p></body></html>
Link to comment
Share on other sites

Line 4: if($_GET['update']).You don't have a querystring variable named "update".

Link to comment
Share on other sites

Line 4: if($_GET['update']).You don't have a querystring variable named "update".
i got error msg :Notice: Undefined index: update in D:\xampplite\htdocs\Login\peperiksaan\add-delete-update\update.php on line 5Notice: Undefined index: msg in D:\xampplite\htdocs\Login\peperiksaan\add-delete-update\update.php on line 50but how to define index update ? im so blurred here..if($_GET['update'])
Link to comment
Share on other sites

Use the empty function, it will not throw a notice if the index is undefined. The fix isn't to define the index, it's to check if it exists before trying to use it. The empty function will do that. Empty will return true if the variable is not set or is empty.if (!empty($_GET['update']))

Link to comment
Share on other sites

Use the empty function, it will not throw a notice if the index is undefined. The fix isn't to define the index, it's to check if it exists before trying to use it. The empty function will do that. Empty will return true if the variable is not set or is empty.if (!empty($_GET['update']))
it doesn't works..but i changed the update.php. Here is my files.. can download now.If u have phpmyadmin..can paste (peperiksaan folder) to mysql--> data http://www.4shared.com/file/Bw5EvW9a/add-v...ate-delete.htmli hope u can do correction for my page.tq.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...