hi...
i want to update employee's record but its not being updated.....can u help me out....
no error is shown to me..... -
<html>
-
<body bgcolor="pink">
-
<?
-
$con=mysql_connect("localhost","root","root");
-
if (!$con)
-
{
-
die('Could not connect: ' . mysql_error());
-
}
-
mysql_select_db("master", $con);
-
$result=mysql_query("select * from emp_company");
-
echo "<table border='3'> <BR><BR><BR><BR>
-
<tr>
-
<th >Employee Code</th>
-
<th>Name</th>
-
<th>Company</th>
-
<th> Shift</th>
-
<th>DOJ</th>
-
<th>DOL</th>
-
<th> Dept</th>
-
<th> Subdept</th>
-
<th>ESI Code</th>
-
<th>P/F</th>
-
<th>Card No.</th>
-
<th>Bank A/C No.</th>
-
</tr>" ;
-
while($row=mysql_fetch_assoc($result))
-
{
-
echo "<tr>";
-
echo "<td>" . $row['ecode'] . "</td>";
-
echo "<td>" . $row['ename'] . "</td>";
-
echo "<td>" . $row['ecom']. "</td>";
-
echo "<td>" . $row['eshift'] . "</td>";
-
echo "<td>" . $row['edoj'] . "</td>";
-
echo "<td>" . $row['edol'] . "</td>";
-
echo "<td>" . $row['edpt'] . "</td>";
-
echo "<td>" . $row['esubdpt'] . "</td>";
-
echo "<td>" . $row['eesicode'] . "</td>";
-
echo "<td>" . $row['epf'] . "</td>";
-
echo "<td>" . $row['ecardno'] . "</td>";
-
echo "<td>" . $row['ebank'] . "</td>";
-
echo "</tr>";
-
echo '<a href="update.php?ecode='.$row['ecode'].' ">Update</a> ' ;
-
}
-
mysql_close($con);
-
?>
-
</body></html>
-
-
<?
-
mysql_connect("localhost","root","root");
-
mysql_select_db("master");
-
-
// ***** This part will process when you Click on "Submit" button *****
-
// Check, if you clicked "Submit" button
-
if($_POST['Submit']){
-
-
// Get parameters from form.
-
$ecode=$_POST['ecode'];
-
$ename=$_POST['ename'];
-
$ecom=$_POST['ecom'];
-
$eshift=$_POST['eshift'];
-
$edoj=$_POST['edoj'];
-
$edol=$_POST['edol'];
-
$edpt=$_POST['edpt'];
-
$esubdpt=$_POST['esubdpt'];
-
$eesicode=$_POST['eesicode'];
-
$epf=$_POST['epf'];
-
$ecardno=$_POST['ecardno'];
-
$ebank=$_POST['ebank'];
-
-
-
mysql_query("update emp_company set ecode='$ecode', ename='$ename',ecom='$ecom', eshift='$eshift',edpt='$edpt',esubdpt='$esubdpt',edoj='$edoj',edol='$edol',eesicode='$eesicode',epf='$epf',ecardno='$ecardno,ebank='$ebank' where ecode='$ecode'");
-
-
// Re-direct this page to select.php.
-
header("location:select.php");
-
exit;
-
}
-
// ************* End update part *************
-
-
// *** Select data to show on text fields in form. ***
-
-
// Get id parameter (GET method) from select.php
-
$ecode=$_GET['ecode'];
-
-
// Get records in all columns from table where column id equal in $id and put it in $result.
-
$result=mysql_query("select * from emp_company where ecode='$ecode'");
-
-
// Split records in $result by table rows and put them in $row.
-
$row=mysql_fetch_assoc($result);
-
-
// Close database connection.
-
mysql_close();
-
?>
-
-
<!-- END OF PHP CODES AND START HTML TAGS -->
-
-
<html>
-
<body>
-
<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
-
<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
-
<p>code
-
<input name="ecode" type="text" id="ecode" value="<? echo $row['ecode']; ?>"/>
-
<p>Name :
-
<!-- name of this text field is "name" -->
-
<input name="ename" type="text" id="ename" value="<? echo $row['ename']; ?>"/>
-
<br />
-
<p>Company
-
<input name="ecom" type="text" id="ecom" value="<? echo $row['ecom']; ?>"/>
-
<p>
-
<p>shift :
-
<!-- name of this text field is "email" -->
-
<input name="eshift" type="text" id="eshift" value="<? echo $row['eshift']; ?>"/>
-
<br />
-
<p>DOJ
-
<input name="edoj" type="text" id="edoj" value="<? echo $row['edoj']; ?>"/>
-
<p>
-
<p>DOL :
-
<!-- name of this text field is "tel" -->
-
<input name="edol" type="text" id="edol" value="<? echo $row['edol']; ?>"/>
-
</p>
-
<p>Dept.
-
<input name="edpt" type="text" id="edpt" value="<? echo $row['edpt']; ?>"/>
-
<p>
-
-
<p>Sub Dept.
-
<input name="esubdpt" type="text" id="esubdpt" value="<? echo $row['esubdpt']; ?>"/>
-
<p>
-
<p>ESICODE
-
<input name="eesicode" type="text" id="eesicode" value="<? echo $row['eesicode']; ?>"/>
-
<p>
-
<p>P/F
-
<input name="epf" type="text" id="epf" value="<? echo $row['epf']; ?>"/>
-
<p>
-
<p>CardNo.
-
<input name="ecardno" type="text" id="ecardno" value="<? echo $row['ecardno']; ?>"/>
-
<p>
-
<p>Bank A/C No.
-
<input name="ebank" type="text" id="ebank" value="<? echo $row['ebank']; ?>"/>
-
<p>
-
<input type="submit" name="Submit" value="Submit" />
-
</p>
-
</form>
-
</body>
-
</html>
-
1 1462 Atli 5,058
Recognized Expert Expert @puneetmca
That does not surprise me, since you don't even bother to check the result of your UPDATE query before you redirect the page.
Read this post, specifically the second part regarding the MySQL error messages.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: |
last post by:
Hello,
Sorry to ask what is probably a simple answer, but I am having problems
updating a table/database from a PHP/
PHTML file. I can Read From the Table, I can Insert into Table/Database, But
not update. Here is a copy of the
script I am using. I do not know what version of MySQL my host is running
nor do I have Shell Access to it. I
|
by: M Wells |
last post by:
Hi All,
Just wondering if you perform an update using a where condition that
actually returns no rows to be updated, does @@Error contain an error
message afterwords?
We want to fire an update ona table against records that may or may
not exists. As a matter of course we test for an @@Error afterwards
and rollback our transaction and exit our stored proc if an error is
returned.
|
by: Mike |
last post by:
Hello,
We are using mysql v4.0.24 on Linux machines.
I'm trying to set up replication with a master and only one slave
database.
The syncronization seems to work well, the relay file on slave is wrote
correctly (Read_Master_Log_Pos and Relay_Log_Pos are updated) but the
information on slave database is not updated.
Master and slave are sincronyzed as shown below but for some reason I
don't understand.
|
by: Lee Rouse |
last post by:
Hello all,
This is going to be a rather lengthy "question".
I have an Access 2k database, separated front end/back end. Front end
copies are on about 30 workstations and used frequently during the
work day. The backend has a table called CLIENTS with approximately
6000 client records. Changes to data in the table are made via a
frontend db Form which has CLIENTS as its record source.
|
by: Lumpierbritches |
last post by:
Thank you in advance. I have a database that I've written in Access 97 and have
some clients using the program. My question is, when I update tables, so they
don't loose their data, is there a way to import, without creating an update
query in Access their records?
The table names and field names are identical, except for any fields added
since the last update. The software is in Beta testing! Is there a way to do
this?
Michael
| |
by: Vladimir Koudela |
last post by:
Hi people,
I am sure most of you have already solved the Access' stupid problem: there
is no simple way of numbring of records shown in a continuous form, needed
so often (top-lists, achieved place in a contest...). Could you suggest any
solution?
Thank you,
Vladimir
|
by: Ian Davies |
last post by:
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an...
|
by: Ron |
last post by:
Hi All,
Using Access2000, winXP.
Table 1 = tblClients displayed on frmClients via qryClients. 2nd table =
tblInvoices shown on frmInvoices via qryInvoices. 2nd table = tblDetails
shown on subform(to frmInvoices) sfrmDetails via qryDetails.
Relationship built between tblClients/tblInvoices/tblDetails by ClientID.
Relationship between tblInvoices/tblDetails by InvoiceID. All works fine if
|
by: PhilOwens |
last post by:
Morning/Afternoon all,
Having slight problem with showing users the progress of a query.....
Bit of background....The database allows users to view the status of documents i.e. Completion date, revision etc. The project manager has an MS Project file in which he changes the estimated date of comepletion of each document.
I currently have Ms Project auto generate a database table everytime it is saved. This table is linked into my...
|
by: KrazyKoder |
last post by:
Hello,
I have MS Access form that basically allows the user to configure an update statement to a single table via the gui. A requirement is to show the count of records that will be updated prior to the actual update.
I'm planning on showing a message box with yes / no buttons that will basically show the selection and update criteria in a user friendly fashion, show the # of records that will be updated and ask if they are sure they want...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |