0

Gyz i have some serious prob my code.
if you find any error plz correct me .

My code for Pay Fees (Update)

<div id="wb_Form1" style="position:absolute;width:365px;height:270px;">
<form name="update" method="post" action="./Update_Fess.php" id="Form1">
<div id="wb_Text7" style="position:absolute;left:10px;top:15px;width:104px;height:16px;z-index:1;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">ISPID#:</span></div>
<input type="text" id="Editbox1" style="position:absolute;left:124px;top:15px;width:198px;height:23px;line-height:23px;z-index:2;" name="ISPID" value="">
<div id="wb_Text9" style="position:absolute;left:10px;top:45px;width:104px;height:16px;z-index:3;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">August 2013:</span></div>
<input type="text" id="Editbox2" style="position:absolute;left:124px;top:45px;width:198px;height:23px;line-height:23px;z-index:4;" name="Aug2013" value="">
<div id="wb_Text11" style="position:absolute;left:10px;top:75px;width:104px;height:16px;z-index:5;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">September 2013:</span></div>
<input type="text" id="Editbox3" style="position:absolute;left:124px;top:75px;width:198px;height:23px;line-height:23px;z-index:6;" name="Sep2013" value="">
<div id="wb_Text12" style="position:absolute;left:10px;top:105px;width:104px;height:16px;z-index:7;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">Octuber 2013:</span></div>
<input type="text" id="Editbox4" style="position:absolute;left:124px;top:105px;width:198px;height:23px;line-height:23px;z-index:8;" name="Oct2013" value="">
<div id="wb_Text13" style="position:absolute;left:10px;top:135px;width:104px;height:16px;z-index:9;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">November 2013:</span></div>
<input type="text" id="Editbox5" style="position:absolute;left:124px;top:135px;width:198px;height:23px;line-height:23px;z-index:10;" name="Nov2013" value="">
<div id="wb_Text14" style="position:absolute;left:10px;top:165px;width:104px;height:16px;z-index:11;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">December 2013:</span></div>
<input type="text" id="Editbox6" style="position:absolute;left:124px;top:165px;width:198px;height:23px;line-height:23px;z-index:12;" name="Dec2013" value="">
<input type="submit" id="Button1" name="" value="Send" style="position:absolute;left:124px;top:195px;width:96px;height:25px;z-index:13;">
<input type="reset" id="Button2" name="" value="Reset" style="position:absolute;left:124px;top:225px;width:96px;height:25px;z-index:14;">
</form>
</div>

And this is my Update Action (Update_fee)

<?php
$host="abc.com"; // Host name 
$username="12333231"; // Mysql username 
$password="213123"; // Mysql password 
$db_name="Members"; // Database name 
$tbl_name="ASDF"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// update data in mysql database 
$sql="UPDATE $tbl_name SET id='$id', ISPID='$ISPID', Aug2013='$Aug2013', Sep3013='$Sep2013, 'WHERE id='$id'";
$result=mysql_query($sql);

// if successfully updated. 
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}

else {
echo "ERROR";
}

?>

Plz Help Me..

Edited by pritaeas: Closed duplicate.

3
Contributors
2
Replies
34
Views
4 Years
Discussion Span
Last Post by pritaeas
0

Sounds like your query is failing. Try to replace

// if successfully updated. 
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}

else {
echo "ERROR";
}

with:

// if successfully updated. 
if($result):
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
elseif(!$result):
    die('Error: ' . mysql_error());
endif;

This should give you a detailed error message as to why it is failing instead of a generic error message.

Edited by Banderson