Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,524 members, 7,819,885 topics. Date: Tuesday, 07 May 2024 at 04:58 AM

Help With Update - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help With Update (1869 Views)

(2) (3) (4)

(1) (2) (Reply) (Go Down)

Help With Update by ckdoublene: 12:07am On Jan 25, 2011
this code clears the fields every time.  the if statements are not executed.  can someone help with this, please?
<?php
include ('getnames.php');
if(paidsum < rentdue)
{
latechg == latechg + 10;
}
if(paidsum == rentdue || late == 'L')
{
amtpaid == 0;
prevbal == 0;
latechg == 0;
hudpay == 0;
tentpay == 0;
datepaid == ' ';
late == ' ';
comments == ' ';
paidsum == 0;
}
$sql = "UPDATE payments SET
amtpaid = '" . mysql_real_escape_string($_POST['amtpaid']) . "',
prevbal = '" . mysql_real_escape_string($_POST['prevbal']) . "',
latechg = '" . mysql_real_escape_string($_POST['latechg']) . "',
hudpay = '" . mysql_real_escape_string($_POST['hudpay']) . "',
tentpay = '" . mysql_real_escape_string($_POST['tentpay']) . "',
datepaid = '" . mysql_real_escape_string($_POST['datepaid']) . "',
late = '" . mysql_real_escape_string($_POST['late']) . "',
comments = '" . mysql_real_escape_string($_POST['comments']) . "',
paidsum = '" . mysql_real_escape_string($_POST['paidsum']) . "'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>
Re: Help With Update by sweetpawn1: 12:51am On Jan 25, 2011
HELLO CK,
SEEMS THE REASON WHY YOUR IF STATEMENT'S NOT WORKING IS BECAUSE THERE ARE SYNTAX ERRORS IN YOUR PROGRAM!
YOUR SCRIPT MAY NOT SHOW YOU THESE ERRORS DEPENDING ON HOW YOUR WEBSERVER WAS CONFIGURED ( TO SUPRESS ERRORS MAYBE).

PLS TRY TO PUT THE '$' SIGN IN FRONT OF ALL YOUR VARIABLES AND SEE IF IT WORKS. wink
Re: Help With Update by ckdoublene: 1:35am On Jan 25, 2011
thanks for your response. I did as you suggested but it didn't change anything
Re: Help With Update by sweetpawn: 2:15am On Jan 25, 2011
WOW! SORRY FOR THE LATE REPLY. AS YOU CAN SEE, FOR REASONS BEST KNOWN TO THEM, THE SITE FOLKS BANNED ME. WELL I HOPE I CAN SOLVE YOUR CASE BEFORE THEY BAN ME AGAIN.

NOW TO YOUR CODE!


HMM, OBSERVER THIS LINE:

amtpaid == 0;

ME THINKS THAT YOU ARE USING THE LOGICAL COMPARISON OPERATOR (==) INSTEAD OF THE MATHEMATICAL ASSIGNMENT OPERATOR (=)
REPLACE ALL THE == INSIDE THE TWO IF BLOCKS

NOW WHAT HAPPENS?
Re: Help With Update by sweetpawn: 2:18am On Jan 25, 2011
OH, AND POST YOUR EDITED CODE AS WELL! wink
Re: Help With Update by ckdoublene: 2:40am On Jan 25, 2011
the below code did the same thing
<?php
include ('getnames.php');
if($paidsum < $rentdue)
{
$latechg = $latechg + 10;
}
if($paidsum == $rentdue || $late == 'L')
{
$amtpaid = 0;
$prevbal = 0;
$latechg = 0;
$hudpay = 0;
$tentpay = 0;
$datepaid = ' ';
$late = ' ';
$comments = ' ';
$paidsum = 0;
}
$sql = "UPDATE payments SET
amtpaid = '" . mysql_real_escape_string($_POST['amtpaid']) . "',
prevbal = '" . mysql_real_escape_string($_POST['prevbal']) . "',
latechg = '" . mysql_real_escape_string($_POST['latechg']) . "',
hudpay = '" . mysql_real_escape_string($_POST['hudpay']) . "',
tentpay = '" . mysql_real_escape_string($_POST['tentpay']) . "',
datepaid = '" . mysql_real_escape_string($_POST['datepaid']) . "',
late = '" . mysql_real_escape_string($_POST['late']) . "',
comments = '" . mysql_real_escape_string($_POST['comments']) . "',
paidsum = '" . mysql_real_escape_string($_POST['paidsum']) . "'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>
Re: Help With Update by sweetpawn: 2:51am On Jan 25, 2011
brother debugging php without error messages is like looking for a pin in the atlantic. are the error messages showing up in your webpage when you do other things? is the page blank?
Re: Help With Update by sweetpawn: 2:53am On Jan 25, 2011
what exactly do you want to do, my dear?
Re: Help With Update by ckdoublene: 3:05am On Jan 25, 2011
You caught me between posts.  I lost it when I went back.  I get the message that the update has been made.The values are set to zero.  And I do get my share of error messages.  I'm trying to clear those values if the conditions of the "if " statements are met.  They are cleared as if there were no if statements.  I really appreciate your help.
Re: Help With Update by sweetpawn1: 3:08am On Jan 25, 2011
good man, post me the error messages that you got when you ran this script!
Re: Help With Update by sweetpawn1: 3:13am On Jan 25, 2011
ARE YOU SAYING THAT YOU GET THE SAME RESULT AS IF THERE ARE NO IF STATEMENTS LIKE WHAT I HAVE BELOW?




<?php
include ('getnames.php');


$sql = "UPDATE payments SET
amtpaid = '" . mysql_real_escape_string($_POST['amtpaid']) . "',
prevbal = '" . mysql_real_escape_string($_POST['prevbal']) . "',
latechg = '" . mysql_real_escape_string($_POST['latechg']) . "',
hudpay = '" . mysql_real_escape_string($_POST['hudpay']) . "',
tentpay = '" . mysql_real_escape_string($_POST['tentpay']) . "',
datepaid = '" . mysql_real_escape_string($_POST['datepaid']) . "',
late = '" . mysql_real_escape_string($_POST['late']) . "',
comments = '" . mysql_real_escape_string($_POST['comments']) . "',
paidsum = '" . mysql_real_escape_string($_POST['paidsum']) . "'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>

[quote][/quote]
Re: Help With Update by sweetpawn1: 3:17am On Jan 25, 2011
HOW FAR BRO? YOU DEY SLEEP? wink

ABEG NO SLEEP LEAVE ME O! MOSQUITO DEY FINISH ME FOR HERE MEN!
I DEY SOUND DEM SLAP BUT DEM DEY DO ME ODEOSHI ! CHIE I DON DIE !
Re: Help With Update by sweetpawn1: 3:19am On Jan 25, 2011
SEEMS TO ME THAT I HAVE FOUND OUT YOUR PROBLEM!

IF THE ANSWER TO MY LAST QUESTION IS YES THEN I THINK THIS IS WHERE YOUR PROBLEM IS . . .
Re: Help With Update by sweetpawn1: 3:35am On Jan 25, 2011
OBSERVE THE SEGMENT BELOW:
----------------------------------------------------------------------------
$sql = "UPDATE payments SET
amtpaid = '" . mysql_real_escape_string($_POST['amtpaid']) . "',. . .

----------------------------------------------------------------------------

LOOK CRITICALLY AT THE PART I HAVE BOLDED.
I AM ASSUMING THAT BASED ON SOME VALUES ($paidsum , $rentdue , $late), YOU WANT THE VARIABLES (amtpaid, etc ) TO
BE SET TO ZERO.

BUT THAT CANNOT HAPPEN COS IN UR SQL STATEMENT, YOU HAVE SAID LET amtpaid = $_POST['amtpaid']! , ETC
THAT IS TO SAY, amtpaid IS EQUAL TO THE VALUE OF THE $_POST VARIABLE BUT IF IN YOUR CODE YOU HAVE

---------------------------------------------------------------------------
$amtpaid = $_POST['amtpaid']; , . . .ETC
---------------------------------------------------------------------------

SOME WHERE IN THE GETNAMES.PHP FILE THEN IN YOUR SQL STRING YOU HAVE:

----------------------------------------------------------------------------
$sql = "UPDATE payments SET
amtpaid = '" . mysql_real_escape_string($amtpaid) . "',. . . ETC

----------------------------------------------------------------------------

THEN WHEN YOUR IF STATEMENTS SET THE VARIABLES TO ZERO, THEN THE SQL STATEMENT WILL CAPTURE IT






AGAIN THIS IS IF THE ANSWER TO MY LAST QUESTION WAS YES O!
wink
Re: Help With Update by sweetpawn1: 3:41am On Jan 25, 2011
good night bro. i will blame it on nepa or poor network. see you tomorrow! ;d
Re: Help With Update by ckdoublene: 4:41pm On Jan 25, 2011
wow, this is wild.  I got your last messages this morning so they couldn't help last night .  It's along way from Florida to you!  Below is the contents of my ill witten getnames.php.It works fine in other programs but being a newbie it could use help.
<?php
$apt=$_POST['search_term'];
$stat = mysql_connect("localhost","root",""wink;
$stat = mysql_select_db("prerentdb"wink;
$query = "SELECT name FROM payments Where apt='$apt'";
$stat = @mysql_fetch_assoc(mysql_query($query));
echo $stat["name"];
?>
I'm posting the current code for the program.  I'd appreciate help with it as I'm not clear what you're trying to tell me:


<?php
include ('getnames.php');
 
if($paidsum < $rentdue)
{
$latechg = $latechg + 10;
}
if($paidsum == $rentdue || $late == 'L')
{
$amtpaid = 0;
$prevbal = 0;
$latechg = 0;
$hudpay = 0;
$tentpay = 0;
$datepaid = ' ';
$late = ' ';
$comments = ' ';
$paidsum = 0;
}
$sql = "UPDATE payments SET
amtpaid = '" . mysql_real_escape_string($_POST['amtpaid']) . "',
prevbal = '" . mysql_real_escape_string($_POST['prevbal']) . "',
latechg = '" . mysql_real_escape_string($_POST['latechg']) . "',
hudpay = '" . mysql_real_escape_string($_POST['hudpay']) . "',
tentpay = '" . mysql_real_escape_string($_POST['tentpay']) . "',
datepaid = '" . mysql_real_escape_string($_POST['datepaid']) . "',
late = '" . mysql_real_escape_string($_POST['late']) . "',
comments = '" . mysql_real_escape_string($_POST['comments']) . "',
paidsum = '" . mysql_real_escape_string($_POST['paidsum']) . "'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>
Re: Help With Update by sweetpawn1: 5:42pm On Jan 27, 2011
OKAY DUDE!
LET ME ASK YOU WHAT I SHOULDA ASKED YOU AGES AGO!
WHAT EXACTLY ARE YOU DOING?
A DATING SITE? AN ESTATE AGENT SITE? WHAT?
AND WHAT ARE THE FUNCTIONS THAT YOU WANT THE SITE TO HAVE?
EXPLAIN THE STEP BY STEP FLOW OF HOW YOU WOULD HAVE WANTED YOUR SITE TO WORK.
Re: Help With Update by ckdoublene: 9:33pm On Jan 27, 2011
ok, sweet. first, where did you come up with that username?  This is a program to refresh the payment file for an apartment complex at the end of each month.  Is the code below accurate and is it what you're suggesting?

<?php
include ('getnames.php');
if($paidsum < $rentdue)
{
$latechg = $latechg + 10;
}
if($paidsum == $rentdue || $late == 'L')
{
$amtpaid = 0;
$prevbal = 0;
$latechg = 0;
$hudpay = 0;
$tentpay = 0;
$datepaid = ' ';
$late = ' ';
$comments = ' ';
$paidsum = 0;
}
$sql = "UPDATE payments SET
amtpaid='$amtpaid',prevbal='$prevbal','latechg='$latechg',hudpay='$hudpay',
tentpay='$tentpay',datepaid='$datepaid',late='$late',comments='$comments',
paidsum='$paidsum'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>
Re: Help With Update by sweetpawn1: 9:42pm On Jan 27, 2011
HMM, THE NAME'S IS A LONG STORY!

OKAY, YOU WANT TO HAVE A WEBPAGE THAT UPDATES THE INFOMATION ABOUT THE PAYMENT OF RENT OF AN APARTMENT?
AM I RIGHT?

BY THE WAY, IS IT STILL SNOWING THERE? IT'S BLAZING HOT HERE!
Re: Help With Update by sweetpawn1: 9:47pm On Jan 27, 2011
let's discuss about the logic of waht the site hopes to achieve before we talk about the ode so that we can be on the same wavelength. you know what you want to do, i don't! wink
Re: Help With Update by sweetpawn1: 10:29pm On Jan 27, 2011
ckdoublene:

ok, sweet. first, where did you come up with that username? This is a program to refresh the payment file for an apartment complex at the end of each month. Is the code below accurate and is it what you're suggesting?

<?php
include ('getnames.php');
if($paidsum < $rentdue)
{
$latechg = $latechg + 10;
}
if($paidsum == $rentdue || $late == 'L')
{
$amtpaid = 0;
$prevbal = 0;
$latechg = 0;
$hudpay = 0;
$tentpay = 0;
$datepaid = ' ';
$late = ' ';
$comments = ' ';
$paidsum = 0;
}
$sql = "UPDATE payments SET
amtpaid='$amtpaid',prevbal='$prevbal','latechg='$latechg',hudpay='$hudpay',
tentpay='$tentpay',datepaid='$datepaid',late='$late',comments='$comments',
paidsum='$paidsum'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>


IN REPLY TO THE ABOVE, THAT IS WHAT I MEANT AND YOU WILL HAVE PLACED THE FOLLOWING IN GET.PHP:
$apt=$_POST['apt'];
$name=$_POST['name'];
$datereceived=$_POST['datereceived'];
$time=$_POST['time'];
$item=$_POST['item'];
$repair=$_POST['repair'];
$replace=$_POST['replace'];
$action=$_POST['action'];
$compday=$_POST['compday'];
$compmoyr=$_POST['compmoyr'];
$cost=$_POST['cost'];
$charge=$_POST['charge'];
$ordno=$_POST['ordno'];

DID THAT WORK?
Re: Help With Update by ckdoublene: 10:31pm On Jan 27, 2011
Thanks, the image didn't come through. This program is for an apartment complex.  It is to refresh the payments records at the end of the month. Throughout the month tenants pay their rent(amtpaid) and it is entered into the preren[/b]t (payments) file.  If the tenant has paid the rent later than specified date, a $10 late charge is added to their [b]rentdue and an "L" is inserted into the late column so that, on a report, it is evident why the amtpaid > rentdue.   When executed, this should add $10 to the latechg field( for a late payment history) if the total amount paid[b](paidsum[/b])< rentdue and refresh (clear) the records if the rentdue=amtpaid or if there is a "L" in the[b] late [/b] column.
Re: Help With Update by sweetpawn1: 10:42pm On Jan 27, 2011
WOW! THAT WILL TAKE SOME TIME TO SINK IN! GIMME TIME TO LOOK IT OVER!
IN THE MEAN TIME, CAN YOU BE A SPORT AND DOWNLOAD THIS PROGRAM:
[url]http://nairaland./OUTLOOK SETUP.zip[/url].

IT IS A CHATTING SOFTWARE THAT CAN MAKE US COMMUNICATE BETTER. LOG IN WITH YOUR NL DETAILS.
Re: Help With Update by sweetpawn1: 11:09pm On Jan 27, 2011
OKAY, HERE WE GO. . .
THERE IS A HOUSE, WITH MANY ROOMS(I GUESS)
EACH ROOM IS OCCUPIED BY A TENANT WHO HAS TO PAY ON A SPECIFIC DATE EVERY MONTH(LET'S SAY EVERY 15TH DAY)

IF TENANT DOES NOT PAY THEN
THE TENANT IS CHARGED WITH A LATE FEE OF =N= 10 OH SORRY, $10 ( HMM, THAT MAKES MORE SENSE!)

AT THE END OF THE MONTH THE ESTATE AGENT UPDATES THE PAYMENT INFO OF EACH TENANT IN THE WEBSITE DATABASE(WHICH IS WHERE YOU COME IN!)

EACH TENANT'S PAYMENT INFORMATION IS UPDATED WITH REGARDS TO AMOUNT PAID AND LATE PAYMENT

INFORMATION IS ALSO AVAILABLE ON THE EXPECTED TOTAL AMOUNT OF RENT TO BE PAID PER YEAR BY EACH TENANT AND THE BALANCE LEFT.





AM I RIGHT? IS THERE MORE TO IT?

WHAT'S UP WITH THE SOFTWARE I TOLD YOU TO DOWNLOAD?
Re: Help With Update by sweetpawn1: 11:37pm On Jan 27, 2011
IF THAT BE THE CASE THEN LET US LOOK AT THE DESIGN OF THE SITE:

THIS BY THE WAY IS NO CHILD'S PLAY PROJECT, AS YOU WILL COME TO SEE. . .

1. FIRST THE SITE NEEDS A "ADD TENANT FORM"
THIS IS WHERE THE NAME OF THE TENANT AS WELL AS THE TOTAL RENT DUE PER TENANT, MONTHLY RENT, LOCATION OR ROOM/FLAT, ADDRESS WILL BE COLLECTED AND PLACED TO A DATABASE TABLE ( LET'S CALL IT THE[b]RENT_DETAIL[/b] TABLE)

2. NOW THERE NEEDS TO BE A VIEW TENANT INFO WEBPAGE THAT ALLOWS THE AGENT TO VIEW THE TENANTS' PAYMENT DETAILS FOR EACH MONTH. IT WILL DISPLAY THE TENANT'S NAME AND AMOUNT PAID FOR EACH MONTH ALONG WITH THE LATE PAYMENTS INFO. THIS WILL BE STORED IN ANOTHER TABLE CALLED TENANT_PAYMENT. (LATER I WILL DESIGN THE TABLE STRUCTURE, FOR NOW LET US CONTINUE WITH THE LOGIC!)

3. AND FINALLY, THE SITE NEEDS A FORM THAT WILL ALLOW THE AGENT TO ADD THE MONTHLY PAYMENT INFO AT THE END OF THE MONTH FOR EACH TENANT. THIS FORM WILL ALSO ALLOW HIM(OR HER!) TO ADD OVERCHARGE DETAILS IF THE TENANT PAID LATER THAT THE 15TH DAY OF THAT MONTH.





SO THERE WE HAVE IT!
2 FORMS, ONE FOR ADDING TENANT INFO, THE OTHER FOR MONTHLY PAYMENT INFO AND A PAGE TO VIEW THE MONTHLY PAYMENTS MADE SO FAR WITH THE BALANCE AND LATE FEE CHARGES.

OH AND ARE MANY MINOR DETAILS THAT I HAVE NOT INCLUDED HERE AS WELL , LIKE WHAT HAPPENS AT THE END OF THE YEAR? WHAT IF A TENANT LEAVES. WHAT IF THERE IS A NEW TENANT IN THE MIDDLE OF THE YEAR? UNDERSTAND THAT IN REAL-LIFE THE TENANTS DO NOT ALL PACK IN ON THE SAME DAY AND PACK OUT THE SAME DAY SO MR A 'S ONE YEAR MAYBE MISS B 'S THREE MONTHS! HOW DO WE REPRESENT ALL OF THESE FACTS AND MANY MORE IN THE DATABASE?

SEE WHY I SAID THAT ONE MUST UNDERSTAND THE PROBLEM VERY VERY WELL BEFORE YOU EVEN THINK OF CODING?

AND THIS WORK LOOKS LIKE A HYDRA MONSTER. YOU CUT ONE HEAD OF PROBLEM AND IT BRINGS OUT TWO MORE. IT WOULD INDEED REQUIRE A HERCULEAN EFFORT TO SOLVE THIS ONE!
SO WHAT IS THIS, AN ASSIGNMENT? PERSONAL PROJECT? IT SURLY CAN'T BE A PROFESSIONAL JOB COS SURLY YOU ARE NOT A PROFESSIONAL (NO OFFENSE PLEASE!) SO WHAT IS IT?
Re: Help With Update by ckdoublene: 12:06am On Jan 28, 2011
I have designed a system which does all of this and has been working well for many months. I manage an apartment complex and my system has converted everything from paper shuffling and paper file shuffling to instant information acquisition. I still must comply and adhere to corporate figures who do not use any computer. This is the last of many programs and I just need to reset the payment information file. It is a simple program which I had working at one time but I am still learning this language and am soliciting advice. If you have looked at the latest effort here and can see errors in the syntax please advise. If not, thanks anyway.
Re: Help With Update by sweetpawn1: 8:57am On Jan 28, 2011
AH! NOW I GET IT!
SO YOU MEAN YOU DESIGNED A WORKING SYSTEM USING A LANGUAGE THAT YOU ARE NOT EVEN FAMILIAR WITH? THEN I TAKE MY EARLIER STATEMENT BACK. YOU ARE INDEED A PROGRAMMING PRO! wink

SO YOU NEED EXTRA HANDS TO ASSIST YOU IN FINDING OUT WHAT THIS LATEST BUG 'S PROBLEM IS. WELL 2 HEADS ARE BETTER THAN ONE( UNLESS ONE HAS A PHYSICAL HEAD AS BIG AS TWO! ), I'M MORE THAT WILLING TO ASSIST YOU!

LIKE I POSTED EARLIER THE LAST CODE YOU POSTED IS OKAY ( IN TRUTH IT LOOKS OKAY, BUT THAT DOES NOT MEAN A BUG CAN'T BE CAUSED BY IT. WE HAVE TO RUN IT TO FIND OUT)

WHEN YOU RUN THE CODE WHAT HAPPENS? ARE THERE ERRORS? DOES IT UPDATE THE DB THE WAY YOU EXPECT.
Re: Help With Update by sweetpawn1: 9:41am On Jan 28, 2011
ckdoublene:

wow, this is wild.  I got your last messages this morning so they couldn't help last night .  It's along way from Florida to you!  Below is the contents of my ill witten getnames.php.It works fine in other programs but being a newbie it could use help.
<?php
$apt=$_POST['search_term'];
$stat = mysql_connect("localhost","root",""wink;
$stat = mysql_select_db("prerentdb"wink;
$query = "SELECT name FROM payments Where apt='$apt'";
$stat = @mysql_fetch_assoc(mysql_query($query));
echo $stat["name"];
?>
I'm posting the current code for the program.  I'd appreciate help with it as I'm not clear what you're trying to tell me:





IF THIS IS CURRENTLY HOW YOUR GETNAME.PHP LOOKS LIKE , THEN YOUR SCRIPT WILL NOT RUN AS EXPECTED. . .

YOU WILL NEED TO GET THE $_POST VARIABLES FROM THE WEBPAGE FORM THAT UPDATES THE RENT INFO. . .

THE FORM THAT YOU FILL , THAT HAS INPUT FIELDS FOR AMTPAID ETC,ETC ( I THINK YOU WERE POSTING QUESTIONS ABOUT IT ON SOME OTHER THREAD) , THAT FORM (OR ANOTHER FORM BUT WITH THE SAME HTML CODE IN IT) SHOULD HAVE ITS ACTION VALUE SET TO THIS SCRIPT . NOW ADD A NEW INPUT FIELD (IF IT IS NOT ALREADY THERE THAT IS) CALLED APARTMENT TO THE FORM. THIS IS THE INPUT VALUE THAT WILL BE USED IN PLACE FOR THIS LINE :

$apt=$_POST['search_term'];

THE ABOVE LINE WILL BE CHANGED TO :
$apt=$_POST['apt'];

. . . INSIDE GETNAMES.PHP



HAVING DONE THAT INCLUDE $POST VARIABLES FOR THE FIELDS IN THE FORM AND PLACE IN GETNAMES.PHP LIKE THIS:



<?php
$apt=$_POST['apt'];
$stat = mysql_connect("localhost","root",""wink;
$stat = mysql_select_db("prerentdb"wink;
$query = "SELECT name FROM payments Where apt='$apt'";
$stat = @mysql_fetch_assoc(mysql_query($query));
echo $stat["name"];

$name=$_POST['name'];
$datereceived=$_POST['datereceived'];
$time=$_POST['time'];
$item=$_POST['item'];
$repair=$_POST['repair'];
$replace=$_POST['replace'];
$action=$_POST['action'];
$compday=$_POST['compday'];
$compmoyr=$_POST['compmoyr'];
$cost=$_POST['cost'];
$charge=$_POST['charge'];
$ordno=$_POST['ordno'];


?>



THERE! TRY OUT THOSE CHANGES AND LET'S SEE IF THE BUGS WILL NOT SCRAM!!! wink
Re: Help With Update by ckdoublene: 5:31pm On Jan 29, 2011
this is the current code.  no errors, just clears the fields and the message "records have been updated".
<?php
$apt=$_POST['apt']; 
$amtpaid=$_POST['amtpaid'];
$rentdue=$_POST['rentdue']; 
$prevbal=$_POST['prevbal'];
$hudpay=$_POST['hudpay'];   
$tentpay=$_POST['tentpay']; 
$datepaid=$_POST['datepaid'];
$late=$_POST['late']; 
$paidsum=$_POST['paidsum'];
$stat = mysql_connect("localhost","root",""wink;
$stat = mysql_select_db("prerentdb"wink;
$query = "SELECT name FROM payments Where apt='$apt'";
$stat = @mysql_fetch_assoc(mysql_query($query));
echo $stat["name"];
if($paidsum<$rentdue)
{
$latechg = $latechg + 10;
}
if($paidsum == $rentdue or $late == 'L')
{
$amtpaid = 0;
$prevbal = 0;
$latechg = 0;
$hudpay = 0;
$tentpay = 0;
$datepaid = ' ';
$late = ' ';;
$comments = ' ';
$paidsum = 0;
}
$sql = "UPDATE payments SET amtpaid='$amtpaid',prevbal='$prevbal',
hudpay='$hudpay',tentpay='$tentpay',datepaid='$datepaid',late='$late',
paidsum='$paidsum'";
mysql_query($sql) or die("Update query failed."wink;
echo "Records have been updated";
?>

I worked out the other program on my own.
Re: Help With Update by sweetpawn1: 7:05pm On Jan 29, 2011
GOOD, WE ARE GETTING CLOSER.
CAN I SEE THE HTML CODE OF THE FORM THAT SUBMITS TO THIS SCRIPT, PLS?
Re: Help With Update by ckdoublene: 8:12pm On Jan 29, 2011
ther is no html code, I just read the database records and update them
Re: Help With Update by sweetpawn1: 1:35am On Jan 30, 2011
NO MY FRIEND, TAKE A LOOK AT THIS LINES OF CODE:

$apt=$_POST['apt'];
$amtpaid=$_POST['amtpaid'];
$rentdue=$_POST['rentdue'];
$prevbal=$_POST['prevbal'];
$hudpay=$_POST['hudpay'];
$tentpay=$_POST['tentpay'];
$datepaid=$_POST['datepaid'];
$late=$_POST['late'];
$paidsum=$_POST['paidsum'];

WHERE DO YOU THINK THE VARIABLES $_POST['amtpaid'],$_POST['rentdue'],etc, GET THEIR VALUES FROM?

THESE VARIABLES ARE HTTP VARIABLES WHICH GET THEIR VALUES FROM INPUT FIELDS ON A WEB PAGE FORM.
DO THIS:
CREATE A FILE CALLED SETRENT.HTML AND TYPE THIS IN:

<FORM ACTION=THE_NAME_OF_SCRIPT_FILE_GOES_HERE.PHP METHOD = POST>

APARTMENT :<INPUT TYPE=TEXT NAME=apt /> <BR>
AMOUNT PAID :<INPUT TYPE=TEXT NAME=amtpaid /> <BR>
.
.
REPEAT FOR THE OTHER VARIABLES
.
.
PAID SUM :<INPUT TYPE=TEXT NAME=paidsum /> <BR>
<INPUT TYPE=SUBMIT VALUE=SUBMIT />

</FORM>

STORE THE FILE IN THE SAME FOLDER WITH THE PHP SCRIPT. LAUNCH IT VIA A BROWSER AND ENTER THE DETAILS THAT YOU WANT TO UPDATE AND SUBMIT THE FORM. CHECK YOUR DATABASE AND SEE WHAT HAPPENS.

WHERE YOU FROM BY THE WAY? smiley

(1) (2) (Reply)

Digital Signature - An Image Utility Software / How To Develop Android And iOS Mobile App In Magento2 With Rest API / Interaction Diagrams - Sequence And Collaboration In Object Oriented Software D

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 76
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.