TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   TalkPHP Developer Team (http://www.talkphp.com/talkphp-developer-team/)
-   -   plz help me, form update got error when i post at my server linux (http://www.talkphp.com/talkphp-developer-team/6319-plz-help-me-form-update-got-error-when-i-post-my-server-linux.html)

salina 06-26-2012 08:02 AM

plz help me, form update got error when i post at my server linux
 
<?php
Header("Cache-Control: must-revalidate");
$offset = 60 * 60 * 24 * 3;
$ExpireString = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
Header($ExpireString);

session_start();
if ($_SESSION['nokp'] == NULL)
{
die("Sila log masuk menggunakan skrin utama !!");
}
$idStaf=strtoupper($_SESSION['nokp']);
require 'dbConnect.php';

$query02 = "SELECT * FROM pengguna WHERE nokp = '$idStaf'";
$result02 = mysql_query($query02) or die(mysql_error());
$nt02 = mysql_fetch_array($result02, MYSQL_ASSOC);
$paras = $nt02['kod_paras'];

if($paras == '1') {
include("./headerHQ.php");
} else if ($paras == '2'){
include("./headerNegeri.php");
}else if ($paras == '3'){
include("./headerDaerah.php");

}


?><HEAD>
<script language="javaScript"
type="text/javascript" src="calendar.js"></script>
<link href="calendar.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</HEAD>
<?


if (isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they supposed to,
passwords matched, username
isn't already taken, etc. */

"nama".$_POST['namaAhli']."<br>";
"emel".$_POST['emel']."<br>";



if (!$_POST['namaAhli'] || !$_POST['emel']){
unset($_SESSION['submit']);
?>

<table width='800' height='100' border='0' bordercolor='#F9F8F2' cellpadding='0' cellspacing='0' align='center' bgcolor='#F9F8F2'>
<TR height='50' valign='center'>
<TD style='border-width:0px' colspan='2' class='tbl_title' bgcolor="<?=$tblheader_color?>" align='center'><span style="color: #FFFFFF"><B>KEMASKINI PROFIL </B></span></TD>
</TR>
<TR>

<TR>
<TD style='border-width:0px' colspan='2'><CENTER><BR><BR>R A L A T<BR><HR><BR><BR>
Medan Nama, Emel dan Nombor Telefon hendaklah diisi !<BR>
<BR>
<input type=button value="Kembali" onClick="history.go(-1)"></CENTER></TD>
</TR>
</table>
<?
}
else {
// no HTML tags in username, website, location, password

$regdate = date('m d, Y');

$kemas_pengguna = "UPDATE pengguna SET nama='".$_POST['namaAhli']."', emel='".$_POST['emel']."' WHERE nokp='$idStaf'";
//$kemas_pengguna2 = "UPDATE penggunalogin SET nama='".$_POST['namaAhli']."', emel='".$_POST['emel']."' WHERE nokp='$idStaf'";
//update table pengguna
$result = mysql_query ($kemas_pengguna);
$add_member = $db_object->query($result);

//$result = mysql_query ($kemas_pengguna2);
//$add_member = $db_object->query($kemas_pengguna2);



if (DB::isError($add_member)) {
die($add_member->getMessage());
} else {
?>
<table width='800' height='100' border='0' bordercolor='<?=$tblborder_color?>' cellpadding='0' cellspacing='0' align='center' bgcolor='#FBFBF4'>
<TR height='50' valign='center'>
<TD style='border-width:0px' colspan='2' class='tbl_title' bgcolor="<?=$tblheader_color?>" align='center'><span style="color: #FFFFFF"><B>KEMASKINI PROFIL</B></span></TD>
</TR>
<TR>
<TD style='border-width:0px' colspan='2'><CENTER><BR><BR><BR><U>PENGESAHAN</U><BR><BR><BR>
Rekod pengguna telah dikemaskini.<BR>
<BR>
<input type=button value="Kembali" onClick="history.go(-1)"></CENTER><BR><BR><BR><BR></TD>
</TR>
</table>
<? }
$db_object->disconnect();}
} else { // if form hasn't been submitted ?>
<tr valign="top">
<td width="800">
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="formKemasProfil" method="post" onsubmit="return checkFormKemasProfil(this);">
<table width='800' height='247' border='0' bordercolor="#FBFBF4" cellpadding='0' cellspacing='0' align='center' bgcolor="#FBFBF4">
<TR height='50' valign='center'>
<TD height="50" colspan='4' align='center' bgcolor="<?=$tblheader_color?>" class='tbl_title' style='border-width:0px; color: #FFFFFF;'>KEMASKINI PROFIL</TD>
</TR>
<TR height='25'>
<TD width='236' height="21" align=right style='border-width:0px'>&nbsp;</TD>
<TD width="564" colspan="3" align=left class="MandMsg" style='border-width:0px'>Medan bertanda asteriks (*) hendaklah diisi.</TD>
</TR>
<TR>
<TD height="27" align=right class="tbl_kurCon" style='border-width:0px'>No. Kad Pengenalan :&nbsp;</TD>
<TD colspan="3" align=left class="tbl_kurCon" style='border-width:0px'><INPUT DISABLED VALUE="<?=$idStaf ?>" TYPE="text" NAME="nokp" size="12">
&nbsp; </TD>
</TR>
<TR>
<TD height="28" align=right class="tbl_kurCon" style='border-width:0px'>Nama * :&nbsp;</TD>
<TD colspan="3" align=left class="tbl_kurCon" style='border-width:0px'><INPUT VALUE="<?=$nt02['nama'] ?>" TYPE="text" NAME="namaAhli" size="70"></TD>
</TR>
<TR>
<TD height="27" align=right class="tbl_kurCon" style='border-width:0px'>E-Mel * : </TD>
<TD colspan="3" align=left class="tbl_kurCon" style='border-width:0px'><input value="<?=$nt02['emel'] ?>" type="text" name="emel" size="50">
</TD>
</TR>


<TR>
<TD style='border-width:0px'></TD>
<TD colspan="3" align=left class="tbl_kurCon" style='border-width:0px'><BR><BR>
<input type="submit" name="submit" value=":: Kemaskini ::"> <BR>
<BR><BR> </TD>
</TR>
</TABLE>
</FORM>

</td>
</tr>

<?php

}
?>
// error came out like this:

Notice: Undefined variable: db_object in /opt/lampp/htdocs/ePameran/kemaskiniProfilPengguna.php on line 83

Fatal error: Call to a member function query() on a non-object in /opt/lampp/htdocs/ePameran/kemaskiniProfilPengguna.php on line 83

tony 06-26-2012 12:44 PM

In this line:
PHP Code:

$add_member $db_object->query($result); 

There is a $db_object variable, but I don't see it defined or implemented any where.
Unless it is in any of these files
PHP Code:

require 'dbConnect.php';
//...
include("./headerHQ.php");
//...
include("./headerNegeri.php");
//..
include("./headerDaerah.php"); 

P.S. Please put code in php tags or highlight tags so that the code is easier to read.

salina 06-29-2012 03:12 AM

plz help me
 
Dear tony, now im understand,the code for $add_member = $db_object->query($result); where by this code before this connect directly from my dbconnect.php(form connect to database),however,my linux server not working WHEN IM USED THAT CODE,that why i change the code to other code like the example:

//form dbconnect.php (connect to database)

<?php

// database info

$dbhost = "localhost";
$dbname = "epameran";
$dbuser = "root";
$dbpass = "Passw0rd";

// connect to the database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

?>
implemented
So,that why $db_object variable,undefined. So what script should i change for $add_member = $db_object->query($result); which query should i use,im confused about this..plz help me

souvenir 08-31-2012 01:48 AM

When I started this project, I only intended to ge Custom T-Shirts off the ground. But since things were moving and no one was there to take over, I continued. But shortly after the initial excitement started, interest faded to only a few members. I am afraid that I no longer have the Short Sleeve T-Shirts Printing time for this project and must resign.


All times are GMT. The time now is 11:06 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0