473,792 Members | 3,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

records are not being updated as well as no error is shown to me............

15 New Member
hi...
i want to update employee's record but its not being updated.....can u help me out....
no error is shown to me.....




Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body bgcolor="pink">
  3. <?
  4. $con=mysql_connect("localhost","root","root");
  5. if (!$con)
  6. {
  7. die('Could not connect: ' . mysql_error());
  8. }
  9. mysql_select_db("master", $con);
  10. $result=mysql_query("select * from emp_company");
  11. echo "<table border='3'> <BR><BR><BR><BR>
  12. <tr>
  13. <th >Employee Code</th>
  14. <th>Name</th>
  15. <th>Company</th>
  16. <th> Shift</th>
  17. <th>DOJ</th>
  18. <th>DOL</th>
  19. <th> Dept</th>
  20. <th> Subdept</th>
  21. <th>ESI Code</th>
  22. <th>P/F</th>
  23. <th>Card No.</th>
  24. <th>Bank A/C No.</th>
  25. </tr>" ;
  26. while($row=mysql_fetch_assoc($result))
  27. {
  28. echo "<tr>";
  29. echo "<td>" . $row['ecode'] . "</td>";
  30. echo "<td>" . $row['ename'] . "</td>";
  31. echo "<td>" . $row['ecom']. "</td>";
  32. echo "<td>" . $row['eshift'] . "</td>";
  33. echo "<td>" . $row['edoj'] . "</td>";
  34. echo "<td>" . $row['edol'] . "</td>";
  35. echo "<td>" . $row['edpt'] . "</td>";
  36. echo "<td>" . $row['esubdpt'] . "</td>";
  37. echo "<td>" . $row['eesicode'] . "</td>";
  38. echo "<td>" . $row['epf'] . "</td>";
  39. echo "<td>" . $row['ecardno'] . "</td>";
  40. echo "<td>" . $row['ebank'] . "</td>";
  41. echo "</tr>";
  42. echo '<a href="update.php?ecode='.$row['ecode'].' ">Update</a> ' ;
  43. }
  44. mysql_close($con);
  45. ?>
  46. </body></html>
  47.  
Expand|Select|Wrap|Line Numbers
  1. <?
  2. mysql_connect("localhost","root","root");
  3. mysql_select_db("master");
  4.  
  5. // ***** This part will process when you Click on "Submit" button *****
  6. // Check, if you clicked "Submit" button
  7. if($_POST['Submit']){
  8.  
  9. // Get parameters from form.
  10. $ecode=$_POST['ecode'];
  11. $ename=$_POST['ename'];
  12. $ecom=$_POST['ecom'];
  13. $eshift=$_POST['eshift'];
  14. $edoj=$_POST['edoj'];
  15. $edol=$_POST['edol'];
  16. $edpt=$_POST['edpt'];
  17. $esubdpt=$_POST['esubdpt'];
  18. $eesicode=$_POST['eesicode'];
  19. $epf=$_POST['epf'];
  20. $ecardno=$_POST['ecardno'];
  21. $ebank=$_POST['ebank'];
  22.  
  23.  
  24. 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'");
  25.  
  26. // Re-direct this page to select.php.
  27. header("location:select.php");
  28. exit;
  29. }
  30. // ************* End update part *************
  31.  
  32. // *** Select data to show on text fields in form. ***
  33.  
  34. // Get id parameter (GET method) from select.php
  35. $ecode=$_GET['ecode'];
  36.  
  37. // Get records in all columns from table where column id equal in $id and put it in $result.
  38. $result=mysql_query("select * from emp_company where ecode='$ecode'");
  39.  
  40. // Split records in $result by table rows and put them in $row.
  41. $row=mysql_fetch_assoc($result);
  42.  
  43. // Close database connection.
  44. mysql_close();
  45. ?>
  46.  
  47. <!-- END OF PHP CODES AND START HTML TAGS -->
  48.  
  49. <html>
  50. <body>
  51. <!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
  52. <form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
  53. <p>code
  54. <input name="ecode" type="text" id="ecode" value="<? echo $row['ecode']; ?>"/>
  55. <p>Name :
  56. <!-- name of this text field is "name" -->
  57. <input name="ename" type="text" id="ename" value="<? echo $row['ename']; ?>"/>
  58. <br />
  59. <p>Company
  60. <input name="ecom" type="text" id="ecom" value="<? echo $row['ecom']; ?>"/>
  61. <p>
  62. <p>shift :
  63. <!-- name of this text field is "email" -->
  64. <input name="eshift" type="text" id="eshift" value="<? echo $row['eshift']; ?>"/>
  65. <br />
  66. <p>DOJ
  67. <input name="edoj" type="text" id="edoj" value="<? echo $row['edoj']; ?>"/>
  68. <p>
  69. <p>DOL :
  70. <!-- name of this text field is "tel" -->
  71. <input name="edol" type="text" id="edol" value="<? echo $row['edol']; ?>"/>
  72. </p>
  73. <p>Dept.
  74. <input name="edpt" type="text" id="edpt" value="<? echo $row['edpt']; ?>"/>
  75. <p>
  76.  
  77. <p>Sub Dept.
  78. <input name="esubdpt" type="text" id="esubdpt" value="<? echo $row['esubdpt']; ?>"/>
  79. <p>
  80. <p>ESICODE
  81. <input name="eesicode" type="text" id="eesicode" value="<? echo $row['eesicode']; ?>"/>
  82. <p>
  83. <p>P/F
  84. <input name="epf" type="text" id="epf" value="<? echo $row['epf']; ?>"/>
  85. <p>
  86. <p>CardNo.
  87. <input name="ecardno" type="text" id="ecardno" value="<? echo $row['ecardno']; ?>"/>
  88. <p>
  89. <p>Bank A/C No.
  90. <input name="ebank" type="text" id="ebank" value="<? echo $row['ebank']; ?>"/>
  91. <p>
  92. <input type="submit" name="Submit" value="Submit" />
  93. </p>
  94. </form>
  95. </body>
  96. </html>
  97.  
Feb 5 '10 #1
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.
Feb 5 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2958
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
2
2141
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.
0
1949
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.
28
4064
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.
5
1522
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
1
2021
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
16
3502
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...
7
2013
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
2
1754
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...
0
1170
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...
0
9669
marktang
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...
0
9517
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,...
0
10207
jinu1996
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...
0
9997
tracyyun
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...
0
9030
agi2029
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...
1
7537
isladogs
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...
0
5435
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...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.