Display Birthdays Coming Up In The Next Couple Of Weeks?
I wonder if someone could help a novice to create a bit of code that will display birthdays coming up in the next couple of weeks?
I have a mysql database with a date of birth(dob) date field but unsure how to check that field against the present date I only have at present, and don't knoe if this is right?
while ($row = mysql_fetch_array($result2))
{
$dob=$row["dob"];
list($year, $month, $day)= explode("-", $dob);
$birth_day = "$day";
$birth_month = "$month";
$birth_year = "$year";
}
Obviously I only need the day and month values but is there a pre built function to do this for me?
View Complete Forum Thread with Replies
Related Forum Messages:
How To Display Calendar 12 Weeks In Advance?
I want to display 12 weeks in 2 weeks from today as a calendar. So if today is August 3rd, I want to see a calendar starting from August 17th + 12 weeks. (I could also use 3 months instead of 12 weeks, whatever is easier to code) Any idea on how to do that?
View Replies !
Birthdays
In a MYSQL database I have stored when the members were born in the form "YYYYMMDD". Now I want a method to select every member who has birthday from today and up to 30 days into the future. I would prefer if this could be done in a MYSQL query. Can anyone tell me how to do this? I have figured out some solutions that will work, but unfortunately not in December because the year will turn.
View Replies !
Get Upcoming Birthdays
I have a column in a mysql table which is formated as 'date' called DOB. I want to create a query that will get all birthdays cumming up in the next ten days.
View Replies !
Arrays, Queries, Birthdays, ...
I have this problem that I cant solve. I have created an agenda (http://28edegem.scoutnet.be/agenda.php) . The agenda contains events and birthdays of the members. I query the events and birthdays per month and sort them on date. This method works fine for the events since they are all for the same year (eg 2003) but doesnt work for the birthdays because someone born in 1980-06-23 will be sorted before someone born in 1876-06-05 . This is a big problem because the person born on the fifth day wont be echo'ed . The problem can be easily be solved by only requesting the month and day part of the birthday. I'm not sure this is possible? If the above doesnt seem to work I can always order the array myself. How can I access a query array? I guess I can't use the fetch_row ?
View Replies !
Send Me An Email Of Birthdays
I'm not sure how this would work automatically but I was wondering how I can send myself an email say 2 weeks before a member in my database is about to have a birthday? I'm assuming the query would need to be running constantly so would it be possible?
View Replies !
A Couple Of Counts...
Having some trouble figuring out how to write the following query: table1 tbl1.id tbl1.name table2 tbl2.id tbl2.name table3 tbl3.id tbl3.quantitysold tbl3.id1 tbl3.id2 select tbl1.name, tbl2.name, count(tbl3.id), ???count of items in tbl3 that had a quantitysold greater than 10??? from tbl1, tbl2, tbl3 where tbl1.id=tbl3.1d1 and tbltbl2.id=tbl3.id2 group by tbl2.name So I cannot figure out how-to write the piece between the question marks, or how to get that figure included in my result set. I'd like it to look like: tbl1.name,tbl2.name, count of table 3 items (tbl3.id), and then the count of items for each name/name that sold more than 10 units Any ideas?
View Replies !
Couple Of Questions
I have been modifying a script for a client. The script uses forms with post data. Now just out of interest of seeing it done in this program, how does it access the $_POST without actully having $_POST typed? For example, consider this simple form: <form name="test" action="test.php" method="post"> <input type="text" name="testtext"> </form> Now when this form is submitted to test.php, I would access the text box like $name = $_POST['testtext']; But in this program Im modifying I dont see any $_POST, it simply just has the variable like $name. Im not sure how this is done as I have never used it. When using an IF, it can get very tedious if you have only 1 comparison, for example: if ( $name == "bob" ) { echo "Bob"; } I have seen another way that omits the {} and makes the IF into one line with a colon ( : )... how does this work? Iv never actually figured that one out
View Replies !
All I Need Is A Couple Of Lines Added To My Script.
categories table info : id: unique auto increment parent_id: all master categories =0 sub categories = id of its master category name : name of category The script I've written is supposed to each master category in the table followed immediately by any sub-categories it may have. If a particular master category does not have any subcategories it should fetch the next master category. My script works fine up to the point where the table contains a few subcategories before the next master category. At this point it lists out the subcategory (which has already been listed earlier within a master category) again assuming that it is a master category. All I need if an if or while statement in my script. I've tried different variations, but nothing worked. Here's the script:
View Replies !
Date() Function, Add A Couple Of Hours To It
The default timestamp that date() uses is the current time of the server which is processing the PHP document. So I wonder if I can add a coupla hours to this time? Say I need these 2 lines on my page: Here it is 1:00 pm, November 25, 2005 ------ date('g:i a, F j, Y'); There it is 4:00 pm, November 25, 2005 ----- date('g:i a, F j, Y', ???)
View Replies !
Getting A Query By Weeks
Im trying to figure out how to write a query to get results by weeks. For example, If I wanted to see the results for this week, I would need to find the beginning of the week and the end of the week. The query Im wanting to build will only show the current week, but it will change dynamically as days go by. So whatever day you look at the list, it will grab that weeks worth of results. I think I can use the date('w') to get the day of the week and then either subtract it to 0 or add it to get the sum of 6 and then use those counts to modify the start and end dates. Or can date('W') be used where it gives me the week of the year? I dont know about using that one because I wouldnt be able to get any dates.
View Replies !
3 Weeks From This Date
I am having trouble creating a script that every three weeks will update itself. What I am trying to do is have the date change on a three-week basis. Example: Today's date is January 8th, 2006, and the set date is on January 21st, 2006. When the day is on January 21st, 2006, the page automatically says February 4th, 2006. How do I do this?
View Replies !
Looking For A Couple Of Php Modules/libraries To Do Standard Web Stuff For Me
I've been contemplating two things for a php project I'm working on : 1) doing user security stuff (users, admins, super-admins etc), pref. compatible with win32 2) doing pagination of large results lists I've been looking (not terribly hard) for standard, mature php libraries to help me do this. However I'm not confident of my own opinion/evaluation of the little I've stumbled across, and have turned to gin and tonic as an alternative. However, I've recently realised that the gin isn't going to actually help me find these libraries. Can anyone give me some recommendations? I'm not looking for full-blown complex stuff. I'd rather have simple, mature, stable, secure and EASY!
View Replies !
Image Uploader With A Couple Addins Not Working??
I have this multiple image uploader form and I have added a couple of text fields into the form, so when it uploads the images, it inserts the text fields into a table. I want to also insert the name of the newly uploaded files into the DB, but I cant seem to understand how they are named when uploaded. Code:
View Replies !
Some Time Fopen Cant Open A Couple Of Sites
i have here a function that accept a string and url site so that it will search a certain keywords if it is included or mention at a given url but some time fopen cant open a couple of sites, what i need is to have a error trapping so that if fclose cant open that site it will jsut skip the url given and return null? im having trouble because i need the the variable where the site is so that i can use it in searching all of it line for the string given Code:
View Replies !
Header Shows Takes Couple Seconds
I have a website in php. It has a header.php, footer.php and then the content pages. When the each page loads the header shows up quickly but then it takes couple seconds (sometimes even 10 sec) until the page loads.
View Replies !
Select Two Weeks Of Records
ok - so i've got some entries with dates in my db. I thought i had it but its not quite there yet. If today is 20061017 and i want to look 3 weeks into the future its not as simple as addings 21 days. How can i get the month to change automatically after it reaches the last day of the month? Code:
View Replies !
Formula To Add A Number Of Weeks To A Date
I was trying to use the following formula to add a number of weeks to a date, where $b is the number of weeks. date('Y-m-d', strtotime($Expiry_Date)+$b*86400*7) However sometimes it added one day less than it should have done. $Expiry_Date was always a Saturday and sometimes the answer was a Saturday and sometimes the previous Friday.
View Replies !
List Weeks Of Year Using Calendar Function
I've been asked to design a small site which contains a page with a list of dates to show a visitor if accommodation (running from Saturday - Friday) is booked or available. Something like this: 2007 2nd Jan - 8th Jan - Available 9th Jan - 15th Jan - Available 16th Jan - 22nd Jan - Booked 23rd Jan - 29th Jan - Available 5th Feb - 11th Feb - Available 12th Feb - 17th Feb - Available etc, etc I'd like to dynamically create the list of dates using the php calendar functions and a mysql database so that each row (52 in total?) could be flagged 'booked' or 'available' allowing easy updating using a back end form. Ideally the page showing the list would have a link taking the visitor to another page showing the following year's dates. Each list would always show a year to view and always run from Jan to Dec.
View Replies !
Calendar To Show Limited Months And Weeks
I'm looking for a simple PHP script/snippet, I've tried Googling but no luck as of yet. Basically it just needs to display 9 months: this month and the next eight months (and of course when it turns to May, April will disappear and another month will be added on the end). It only needs to display Monday to Friday for each week. The table cell for each day needs to say the day number, e.g. 12.
View Replies !
Where Is My Php.ini Coming From?
I was having a problem with session variables, and realized that I didn't have my php.ini file set up properly. So I went to fix it and discovered that php is not getting my php.ini from the default directory because my changes weren't shown when I restarted the web server and ran phpinfo(). I'm running apache 1.3.14 and php 4.0.4 on windows 98. The php.ini file that I'm altering is in c:windows Apparantly this is the default for the windows binary build, but when I change it and restart the web server, the changes don't take place. That's the only place I have php.ini, so where is php getting this info from and how can I change it?
View Replies !
Where Is // In Redirect Coming From?
I'm hoping someone out there has experienced this and can tell me right off what is going on. I'm getting a double slash in my URL when I do a redirect if my host is a 'web' host, but when my host is localhost (on my development machine and not on the web) I get the desired single slash. The redirect code is as follows: header("Location: http://".$_SERVER['HTTP_HOST']. dirname($_SERVER['PHP_SELF']).'/index.php'); exit; Note that I tack on '/index.php' because in testing on my localhost I found I needed the leading slash since dirname($_SERVER['PHP_SELF']) was not returning a string ending in a slash (ie, no slash after the folder location for the web project). So the leading slash HAS to be there for this code to work on my localhost development machine. However, when uploaded to the regular site, I find that the leading slash should not be there, as I wind up redirecting to (for example): Now, it happens that the double slash still works (it loads the page), although it DOES effect how some of the code executes under a refresh (selection of random backgrounds based on cookie settings when a page is first reloaded - truly bizaar!). Is there an easy way I can recode the redirect so it will work correctly on both my localhost development machine and on the web?
View Replies !
Coming From An Assembler
Coming from an Assembler/C/C++/C# background I got to say this is butt ugly: <?php echo "2 + 2 = " . 2+2; // This will print 4 echo "2 + 2 = " , 2+2; // This will print 2 + 2 = 4 echo "test " . 2+2; // This will print 2 ?>
View Replies !
Windows EOL Characters Coming In
Have a form that reads a file and presents it for editing in a <TEXTAREA> window. Then saves the data using PHP fwrite. However, if somebody is using a Windows machine when using the form, the resulting file has ^M on the end of each line. Any ideas on how to solve this or get rid of these characters?
View Replies !
Blank Page Is Coming..
I have a problem installing php5 in windows xp. I am getting a blank page while i process the file. if i type localhost the iis page is loading. i created a virtual directory 'php' if i type http://localhost/php means it is showing all the files in the directory but if i click the file a blank page is coming. can anybody give me a solution to resolve this.
View Replies !
POST Variables Not Coming Through
For some reason, at random posts, the post variables don't get thru to the server. For example, if there is are two text fields: name and email... (I have register_globals on)... When I try to update the database with a query and use $name, $email, the $name is missing or the $email is missing. I am building an intranet application and all the 20 or so clients run IE. This happens very rarely. Something like once in 100 updates. But I can see this in the log files as update contact set name="", email="asda@pol.com" where contact_id=918. Notice the name field is blank. I have JS checks in the client side which does not allow blank name field.. Is this an IE random error? How do I get over this?
View Replies !
From Address Is Not Coming In The Mail.
i am sending a mail using a php mail() function. But reciept is not able to see , who sent the mail , ie the correct from address is not coming in the mail, instead some other address related to IP Address is coming.
View Replies !
Parser Error Coming
$query = "SELECT id, name FROM photo"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <a href="down.php?id =<?php=$id;?>"><?php =$name;?></a> <br>//parser error in this line <?php } } ?> help me i got this code in mysql tutorial but i am getting parser error in the above specified line.
View Replies !
Env. Variables Sometimes Coming Up Empty
Has anyone ever had this problem? I have a formmail script that uses the $HTTP_REFERER variable to check that the page where the user filled out the form is of the allowed referers. If it is not, then it gives an error message saying that they were coming from an unauthorized domain (I did not write this script, it was inherited, but I think it is a general formmail script anyways). Well there is 1 group of people (my clients, actually) who, when they fill out the form and submit it, it gives them the error message. So, I had it email me the environment variables so I could see what 'unauthorized domain' they were coming from - I used $_SERVER["HTTP_REFERER"], $HTTP_REFERER, and get_env("HTTP_REFERER"). When I fill out the form it emails me my environment variables fine - but when THEY do it, it sends an empty string for everything except ip address and browser. It gives empty string for referer. They are using Windows IE, but if I test it on a Windows machine using IE, I do NOT get the error! It is sooo hard to fix because I can not reproduce the error for the life of me. It is only on their end. Has anyone ever had this problem before? And if so, how did you fix it?
View Replies !
Non Sgml Characters Coming Out Of My Db
Does anyone know what non SGML character number 148 is? I think it is a little boxy thing, how do I weed this out and stop it causing validation errors? I think it got there from me endlessly copying and pasting into my db. In case it is also important, I edit the db in access and upload to mysql.
View Replies !
Text Coming From Database
I have a web site with a MySQL database and I initialy used MySQL 4.0.22 database but now I've moved to a new server that uses the version 4.1.11 MySQL. By doing this all the apostrophes from all the text got replaced by question marks and there are some random question marks throughout the text.
View Replies !
Displaying A Pdf Coming Out Of A Mysql-db In A Frame
I have a mysql-database with some pdf in it. I can send them to a webbrowser using this script: <?php //output.php4 $sql = "SELECT * FROM tbfiles WHERE tbfiles.ID={$id}"; $result = mysql_query($sql); $dateien = mysql_fetch_object($result); $daten = $dateien->Inhalt; $name = $dateien->Dateiname; $groesse = $dateien->Groesse; $typ = $dateien->Typ; header("Content-type: $typ"); header("Content-length: $groesse"); header("Content-Disposition: attachment; filename=$name"); echo $daten; ?> My problem is that I get a download dialog where I want to save the pdf but I want to open it in a fram or iframe like this: <iframe src="./output.php4?id=129" width="100%" height="400" name="outputbox"> where id=129 indicates my document. I get the correct result in Internet Explorer (but not in Opera) if I change the script like this: header("Content-type: image/jpeg"); header("Content-Disposition: inline; filename=$name"); Does anybody know a solution for Opera? Then I could provide different scripts depending on the browser. Or even better a solution working in all browsers?
View Replies !
Validation Keeps Coming Back As Incorrect
for some reason my validation keeps coming back as incorrect when it isnt. this is the code thats giving the problem: if ($raw_password < 5){ echo ("Your password must be greater than 5 characters."); require_once ('page_footer.php'); die (""); } The code keeps returning 'Your password must be greater than 5 characters.' even if i have typed in 20 characters
View Replies !
Why Are My Images Coming Out As Black Jpegs?
I've written a script to create thumbnails of my images. Here is my code: list($width, $height) = getimagesize($filename); $new_height = 100; $new_width = ($new_height / $height) * $width; $image_p = imagecreate($new_width, $new_height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagejpeg($image_p "images/thumbs/1.jpg", 100); When I look at images/thumbs/1.jpg it's just a blank image. Anyone have any ideas why this would happen and how I can fix it?
View Replies !
Variable 'page' Coming Up Undefined
i've came up with the following script for an 'easy' write to file from form page. i've done it a few times before with success, but for some strange reason this time i'm having a bit of trouble with the variable 'page' coming up undefined. It's probably something really simple but i can't seem to be able to spot it. if (isset($_POST['update'])){ $file = fopen('db/pages/home.php', 'a', 1); fwrite($file, $page); fclose($file); } else { $lines = file('db/pages/home.php'); $l_count = count($lines); for($x = 0; $x< $l_count; $x++) { }.......................
View Replies !
Http_referer Is Coming Up Blank On My Localhost
My http_referer is coming up blank on my localhost, and from what I've read today it's unreliable, so I'd like to remove it from the site. What I'm trying to achieve is a redirect from my login page, depending on which page the user came from. there are several processes requiring logins, and I want to return them to where they came from once they logged in.
View Replies !
Text From Database Coming Out Garbled
Finding this a bit of a strange problem. I'm setting up a Web Mail/PM system. The idea is that the messages sent will be encrypted, stored in the MySQL database, then when the user reads their mail the messages will be decrypted for them. I have the encrypt/decrypt working fine, if i submit a form and echo the submitted variable encrypted, then decrypted it works. If i submit the encrypted string to the database it works, but when I read it from the database decryption fails and I get jibberish. Code:
View Replies !
Verifying A Link Is Coming From The Current Site
I need to be able to compare $_SERVER["HTTP_REFERER"]; to $_SERVER["HTTP_HOST"]; and make sure they are coming from the same place. The problem is, I don't know how to use "mid" essentially in PHP. The returned values are: $_SERVER["HTTP_REFERER"]; - http://www.mydomain.com/this/that $_SERVER["HTTP_HOST"]; www.mydomain.com How would I do that?
View Replies !
Stop Access Counter - Updated - Coming From Outside
I finaly managed to write the script which logs every user access on the site but now I can not stop it! My counter is a part of my user record in mySQL 'users' table. The idea was to log the user coming from outside world and not his/her browsing the site, which is the case now. I tried the HTTP_REFERER but it is empty. So I tried a little cheating - on the transfer from the login screen I attached to FORM's ACTION string a little cheat in the form of "?referrer=index", which nicely passes this info for me. After checking password I update the counter and put $referrer = "" - which I expected would stop the intra-site updating. To my surprice it did not. It happily updates the counter every time the user hits this page, which could be 4-10 times at one visit.
View Replies !
How To Stop Spam Coming Through Online Form
Im getting a lot of spam coming through a form on my site, that basically sends the information to a database that I then check and approve on reject. Does anyone know what those things are called that generate a picture of letters and numbers that have to be filled in before the form will submit? And where can I get one to add to my form?
View Replies !
|