SangrelX
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by SangrelX
-
-
Ok basic setup is
Table name = unit_data
I have a field unit_paid_date colum type = DATE
unit_paid_date = 2011-03-02
thats yyyy-mm-dd
lets say for example the DueDate is the Second of every month
I need to select all records from unit_data that are PAST DUE
so if the last paid date is 2011-01-02
that record will pop up as PAST DUE
BUT if that paid date is say 2011-03-10 it will not be shown because the invoice was paid Ahead of due date
I had this almost working properly -- but can use any help you guys offer.
I was attempting to use mysql WHERE queries and do checks against paid_date but failed
Thanks
-
I would go for a more simple solution based on what you need and also possibly a faster solution. Regular expressions tend to be slower so this may work faster for you / be easier to understand
<?php //the main number to get $num = 82; //the string to compare $string = '|47||67||82||55||69|'; //remove the extra characters from the beginning and end and put the string as an array $compare = explode('||',substr($string,1,strlen($string)-2)); //compare it if(in_array($num,$compare)){ echo 'its there'; } else { echo 'not there'; } ?>
i almost cried when this worked LMAO.... i had been pounding my head on the keyboard trying to understand why last night i couldnt get a function this simple to go
Thank you....
as for doing the DB Search I didnt wanna do it to minimize hits on the DB. this way i only access the DB 1 time per call to this page and that to either ADD the ID or Update the IDs in the record
Thank u guys for all your help.. thats why I love these forums LOL
-
Ok... I had typed this post out ONCE already and when I clicked REFRESH IMAGE to get a diff captcha it ERASED MY POST
LMAO this is not my night....
What I need help with is probably more simple then I can even think right now - ive been digging at this for 3 hrs now and im out of time for the night
I have a DB Record storing ID's between PIPES |
when the initial entry is made in DB it stores it like so
|47| NOTE: the number could be different these are ID's number doesnt matter its just between Pipes
When the second entry is added its added like so
|47||67|
say we have a total of 5 Entries
|47||67||82||55||69|
I need to find ID 82 in that string and it has to be between Pipes
Find 82 in data between | and return that ID 82
I am putting between pipes because the ID's can be duplicate digits in different lengths
so say I have 8 as my ID and down the string i have another id as 88 -- I cant possibly find the correct ID without some sort of seperation character so i used Pipes
soo my end goal is the ability to search and if true or false do action
if ($result == $find_id){ echo "ID is there"; }else{ echo "NOT THERE -- Adding it"; }
Any help is appreciated guys
Thanks
SangrelX
Select overdue record using DATE Type Column
in PHP Coding Help
Posted
Here is the Select im using
I see where your going with this but it will not work. this is comparing the Date in the field unit_paid_date to the current Date with the Day being a variable which is the actual DAY each month its due
im lost but then again ive been trying to learn how to do this for a while now
it should be simple
if the user pays his bill ahead of the due date it leaves him alone
if the users bill was paid say LAST month on the 2nd then it will be marked as late and the record shown
I had at one time it worked all execept say if the user paid his bill Ahead of time it still marked it as a late payment .. and i didnt fully comprehend why so i removed that code and now I dont remember what it was lol..
i hope someone understands my end goal here and can help me out
Thanks