473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

data not storing into the mysql database?

127 100+
this is my form...
Expand|Select|Wrap|Line Numbers
  1.  <form action="savesalary.php" method="post">
  2.  
  3. <table width=100% border=0 bordercolor="#CC6633">
  4.  
  5. <tr>
  6.                         <tr>
  7.                         <td>Employee Id: </td>
  8.  
  9.            <?php
  10.           $empid=$_GET['id'];
  11.  
  12.                             print"<td><input type='text' name='empid' value='$empid'></td>";
  13.                             ?>
  14.  
  15.  
  16.                         </tr>
  17.  
  18.                         <tr>
  19.                         <td>No of Days in Month: </td>
  20.                         <td>
  21.  
  22.                             <input type='text' name='ndm'>
  23.  
  24.                         </td>
  25.                         </tr>
  26.                          <tr>
  27.                         <td>No of Days Present: </td>
  28.                         <td>
  29.  
  30.                             <input type='text' name='ndp'>
  31.  
  32.                         </td>
  33.                         </tr>
  34.                          <tr>
  35.                         <td>Week Offs: </td>
  36.                         <td>
  37.  
  38.                             <input type='text' name='woffs'>
  39.  
  40.                         </td>
  41.                         </tr>
  42.                          <tr>
  43.                         <td>Additions: </td>
  44.                         <td>
  45.  
  46.                             <input type='text' name='add'>
  47.  
  48.                         </td>
  49.                         </tr>
  50.                          <tr>
  51.                         <td>Deductions: </td>
  52.                         <td>
  53.  
  54.                             <input type='text' name='ded'>
  55.  
  56.                         </td>
  57.                         </tr>
  58.  
  59.  
  60. <tr>
  61. <td colspan="2" align="center"><input type="submit" name="submit" value="Send"></td>
  62. </tr>
  63.  

this is my savesalary.php


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include("config.php");
  3. $empid=$_POST['empid'];
  4. $query="SELECT * FROM employee WHERE empid='$empid'";
  5. $result=mysql_query($query);
  6. $num=mysql_numrows($result);
  7. $i=0;
  8. while ($i < $num)
  9. {
  10.    $fsal = mysql_result($result, $i,"fsal");
  11.     $i++;
  12. }
  13.  
  14.  
  15. $empid=$_POST['empid'];
  16. $ndm=$_POST['ndm'];
  17. $ndp = $_POST['ndp'];
  18. $woffs= $_POST['woffs']; 
  19. $add = $_POST['add'];
  20. $ded = $_POST['ded'];
  21. $month = date ("M-Y");
  22.  
  23. $tdaysp = ($ndp)+($woffs);
  24. $ds = ($fsal/$ndm);
  25. $t = ($ds)* ($tdaysp);
  26. $total = ($t)+($add)-($ded);
  27. $sal= round($total);
  28.  
  29. $query1 = "insert into salary (empid, ndm, ndp, woffs, add, ded, month, total) 
  30. values ('$empid', '$ndm' ,'$ndp','$woffs' ,'$add','$ded','$month','$sal')";
  31. mysql_query($query1);
  32.  
  33. //print "Data Updated Sucessfully";
  34. ?>
  35.  

the data is not storing into the salary table... why?
Aug 6 '10 #1
2 1307
Atli
5,058 Expert 4TB
READ FIRST: Turn On PHP Debugging Messages

Try that. Right now your code is completely ignoring the result of the query. You need to print the error if you want to debug it.
Aug 6 '10 #2
impin
127 100+
i find it.. i changed the variable name "add" to "adds" and it works...
Aug 7 '10 #3

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

Similar topics

1
by: Accelerator | last post by:
Hi All I need to create a drop down list that is populated from a MySql database. I'm using ASP.net 1.1. If you have any related code, please post it here. Many thanks Accelerator
5
by: mantrid | last post by:
Hello My web hosting company has lost my data due to the mysql software failing, it only affected those people using innoDB engine. I asked them why they didnt restore from a back up. They said...
2
by: Christoph Krammer | last post by:
Hello, I try to write a python application with wx that shows images from a MySQL database. I use the following code to connect and get data when some event was triggered: dbconn =...
1
by: viresh | last post by:
Hello everybody, I am quite beginner as a software professional in php & mysql. I want to know how I can fetch data from mysql database to show in a form's drop down box with php...
4
by: sssk28 | last post by:
i have written a jsp code which fetches data from mysql database. it performs insertion operation correctly but it fails while fetching the data. i am getting error on line which contains...
2
by: cleary1981 | last post by:
Hi, Think im on the right path here. What I am trying to do here is to read data from a mysql database based on a certain condition. I then want to use that data to produce an SVG drawing. Where...
2
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following function to get the data from mysql database. i have entered appnum field as text filed in the database which has leading zeroes to this field like if...
2
by: sarah aziz | last post by:
Hello all I am trying to retrieve the data from mysql database by php to plot a flot graph can anyone help me please this is all i have done for now Php $sql = mysql_query("SELECT count(Msg_ID)...
17
by: msmjsuarez | last post by:
Hello, I need help... How to automatically insert data to mysql database without submit button using php? Is there a way on this? thanks a lot.
0
by: adajon92 | last post by:
I have a problem with mySQL database. To start off, I'm a super N00b and am trying to make a web page using PHP and MySQL for a class project. Currently the database and website are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...

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.