Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,160,206 members, 7,842,521 topics. Date: Tuesday, 28 May 2024 at 09:59 AM |
Nairaland Forum / Science/Technology / Programming / Help With Update (1873 Views)
Re: Help With Update by sweetpawn1: 1:42am On Jan 30, 2011 |
OH, TO LAUNCH THE SETRENT.PHP USE YOUR LOCAL HOST SERVER ADDRESS TO LAUNCH IT THAT IS TYPE: http://localhost/THE FOLDER WHERE THE FILE IS IN YOUR SERVER/SETRENT.PHP DO NOT DOUBLE CLICK THE FILE'S ICON TO LAUNCH IT. WON'T WORK THAT WAY. |
Re: Help With Update by ckdoublene: 1:56am On Jan 30, 2011 |
yeah I click on the xammp control and start the apache and mysql every morning, then click on the shortcut to launch my site and everything runs great except that I never got this program to execute right. |
Re: Help With Update by ckdoublene: 8:19pm On Jan 30, 2011 |
you know, this is futile. This is(should be) such a simple little program. All was good when I used the below program <?php using Set, Where paidsum = rentdue OR late = ''L', but when I tried to also "add the $10 to the latechg if the paidsum < rentdue " I got lost. |
Re: Help With Update by sweetpawn1: 11:13pm On Jan 31, 2011 |
DID YOU DO THE THINGS BELOW TO SEE IF IT WORKED? sweet-pawn: |
Re: Help With Update by ckdoublene: 5:22am On Feb 01, 2011 |
You want to know where such a dummy's from? Florida, USA - you? You're saying I can read & only update the database file by using the WHERE statement? I'm trying to avoid reports & don't know the values to enter before making comparisons ( late = 'L') I'm getting the variables the same place (WHERE paidsum = rentdue) |
Re: Help With Update by sweetpawn1: 7:31am On Feb 02, 2011 |
OKAY, I BELIEVE I KNOW WHAT YOUR PROBLEM IS NOW. . . REPLACE YOUR CODE WITH THE ONE BELOW: <?php $stat = mysql_connect("localhost","root","" $stat = mysql_select_db("prerentdb" $query = "SELECT name FROM payments Where apt='$apt'"; $stat = @mysql_fetch_assoc(mysql_query($query)); echo $stat["name"]; $result= mysql_query("select * from payments" while($row=mysql_fetch_array($result))//this will let us go through the records of the paymets table one by one. { //start of loop $id=$row['id'];//extract id from the current record $paidsum=$row['paidsum'];//extract paidsum from the current record $rentdue=$row['rentdue'];//extract rentdue from the current record $latechg=$row['latechg'];//extract latechg from the current record if ($paidsum < $rentdue) //the $add variable will be added to the $latechg variable depending on the condition above { $add = 10; } else { $add=0; } // now we add $add to $latechg $add=$latechg+$add; //the edit set sql statement is executed for the current record //observe that we have added: latechg = $add so that the latechg field of the current record will have the value of $add $sql = "UPDATE payments SET amtpaid = 0, prefvbal - 0, hudpay = 0, tentpay = 0, datepaid = ' ', late = ' ', paidsum = 0 , latechg = $add WHERE paidsum = rentdue OR late = ''L'"; mysql_query($sql) ; //end of loop } echo "Records have been updated"; ?> THERE NOW. THAT OUGHT TO DO THE TRICK! TEST THE CODE ABOVE AND GIVE ME FEEDBACK. IT SHOULD WORK BUT FROM MY EXPERIENCE IN PROGRAMMING, THERE MIGHT BE SOME BUG IN IT AND THIS IS MORE SO , SINCE I HAVE NOT TESTED IT MYSELF. GIVE ME FEEDBACK BROTHER. HMM, I KNEW YOU WHERE NOT FROM NIGERIA WHEN YOU DID NOT RESPOND TO THIS HUMOROUS COMMENT I MADE HERE: sweet-pawn: ONLY A NIGERIAN BORN WOULD HAVE GOTTEN THAT. AND ALSO THE FACT THAT YOU DID NOT RESPOND TO THIS: sweet-pawn: MADE ME THINK, THAT YOU PROBABLY OWNED A MACINTOSH PC THAT WOULD NOT RUN THE APP WHICH WAS WINDOWS BASED. GOOD TO KNOW YOU BRO, AND BELIEVE ME , YOUR NOT DUMB. I KNOW SEVERAL FOLKS WHO GRADUATED FROM COLLEGE WITH ME THAT DON'T KNOW JACK ABOUT WHAT WE ARE TALKING ABOUT HERE. AS FAR AS THEY ARE CONCERNED, WE ARE JUST SPEAKING CHINESE! |
Re: Help With Update by ckdoublene: 4:15pm On Feb 02, 2011 |
I figured that was a Nigerian saying - in plain English, what's the meaning? When I saw the new code I thought "alright, that's what I was trying in the beginning" - but no, it did nothing to the database records. I got the message "records have been updated" but when I displayed the file it hadn't changed. |
Re: Help With Update by sweetpawn1: 6:24pm On Feb 02, 2011 |
HMM, HOW DO YOU ENTER DATA INTO THE DATABASE NORMALLY? COULD YOU UPLOAD A SNAP SHOT OF THE SOFTWARE INTERFACE THAT YOU USE TO DO IT? WHAT IS THE GMT IN YOUR AREA. MINE IS GMT+1, SO I CAN HAVE AN IDEA OF WHEN TO EXPECT YOUR POST OR BETTER STILL, COULD I INDULGE YOU INTO USING MY MOBILE PHONE APP? IT'S A SIMPLE TEXT BASE CHATTING SOFTWARE. IF YOUR PHONE SUPPORTS JAR FILES YOU CAN DOWNLOAD IT HERE: http://jist./Jist.jar |
Create Your Own Youtube Like Video Site Easily With Wordpress / Recommend Python Practice Projects For Freshers, / Programmers In Da House Pls I Nid Ur Help
(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. 24 |