PHP - Birthday List
im trying to generate a birthday list for people who have birthdays today. Unfortunatly it keeps coming up 0 when there are birthdays today. here is the query:
$birthday_query = $link->query("SELECT u.u_username, u.u_birthday FROM ".TBL_PREFIX."users u WHERE u.u_banned = '0' AND u_confirmed = '1' AND u_birthday LIKE '" . $link->asf_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' ORDER BY u_username ASC"); the query string is: Code: [Select] SELECT u.u_username, u.u_birthday FROM asf_users u WHERE u.u_banned = '0' AND u_confirmed = '1' AND u_birthday LIKE '25- 1-%' ORDER BY u_username ASC there is a birthday in the database which appears like: Code: [Select] 25-1-1986 but it still says no birthdays. any ideas? and yes the user is confirmed and not banned. Similar TutorialsGood evening,
I am working on a birthday validation using Jquery datepicker. I am trying to make the birthday section validate whether the birthday input is in a date format and I want to prevent users under 18 from join. Thank you
accountsettings.php
<input type="text" name="Birthday" id="Birthday" maxlength="50" value=" <?php if($form->value("Birthday") == ""){ echo $session->userinfo['Birthday']; }else{ echo $form->value("Birthday"); } ?>">process.php function register( $subuser, $subconfirmuser, $subpass, $subconfirmpass, $subemail, $subconfirmemail, $subFirstname, $subLastname, $subGender, $subBirthday, $subRegion, $subCountry, $subCity_State, $subQuestion, $subAnswer, $subConfirmAnswer){ global $database, $form, $mailer; //The database, form and mailer object /* Birthday error checking */ $field = "Birthday"; //Use field name for Birthday if(!$subBirthday || strlen($subBirthday = trim($subBirthday)) == 0){ $form->setError($field, "* Birthday not entered"); } else{ /* I've attempted different formulas but it did not work here */ $date = date('yyyy-mm-dd'); if( $subBirthday > $date){ $form->setError($field, "* You are too young!"); } } HI friends. I want to display the birthday list a week advance. I store DOB in m/d/Y format. Could u please help me ????????? Hi Hello I have a problem with this code, I need to make a simple calendar with birthday reminder but it is not working. I just created two variables ($BirthdayMonth and $DayBirthday) but when I add the day, I need this variable ($DayBirthday) to be static, the problem is when I change to another month then the variable $DayBirthday would be changed. Here is the source code: <?php $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13 ) { $next_month = 1; $next_year = $cYear + 1; } ?> <div id="calendar_div" name="calendar_div"> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"> <a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; $BirthdayMonth = "February"; $DayBirthday = 12; for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ) echo "<tr>\n"; if(($i == $DayBirthday)) { echo "<td bgcolor='#0000FF' align='center' valign='middle' height='20px'>".($i - $startday + 1) ."</td>\n"; } elseif($i < $startday) { echo "<td></td>\n"; } else {echo "<td align='center' valign='middle' height='20px'>". ($i - $startday + 1) . "</td>\n"; } if(($i % 7) == 6 ) echo "</tr>\n"; } echo "</br>"; echo "</br>"; echo $startday; echo $thismonth ?> </table> </td> </tr> </table> </div> Where Am I failing or where is the problem ? friend i store dob as 12/17/1984 in my table now how do i go on geting users birthday if today is 12/16 how could i display only the mm/dd from table?
i tried
$today = date("m-d"); $result = mysql_query("SELECT * FROM members WHERE dob = '".$today."'");but not happening Hello I have a mysql database with users and birthday. I'd like to set a cronjob to send an e-mail on the aniversary of each one. Can i do a script in php and the cron job execute it? If not how can i do this? Anyone can help? THanks Before I go digging around for code or conversion to unix time stamp, I'm curious how many of you have a birthday entry on a form which is the least hassle for the person filling out the form. For example a text box and they can enter 12/1/1992 or 12/1/92 or 12-1-1992 or three text boxes for month, day and year and if so, require an 01 or a 08 or 4 characters for year. The second method with three boxes would easily convert to a date stamp entry on the other hand if there is a php conversion that would convert any format (12/1/1992, 12/01/92, etc) to a unix time stamp that would make it easier for the person filling out the form. Thanks in advance for any ideas or help. Mike In my database I have a field for DOB for each of the records. This field is of mysql type 'date'. I would like to have a script to select only the members who's birthday it will be within the next month.. I'm very unsure as to how to approach the comparison of the current date and the date that is stored in the database... Anyone able to help me? Thanks Denno Code: [Select] <?php "INSERT INTO costumers (firstname,lastname,birthdate,product_name,price,details,category,subcategory,city,state,zipcode,country) VALUES('$fname','$lname','$birthday','$itemname','$price','$details','$category','$subcategory','$city','$state','$zipcode','$country')"; ?> What am I missing in the INSERT query above that is not inserting the values of birthday.? Hi, In my mysql database i have a text input option, in the registration form and edit my details form i have a multiple select dropdown list, which user selects options to populate the text input box, which ultimately populates the text field in the mysql database. All works perfectly. The dropdownlist consists of 3 parts <optgroups> first is current selection (what is the usesr current selection)works fine, The second <optgroup> is existing words, what words we(the site) have given as options, and the third <optgroup> is the words that others have used. This is where im having a small problem. Because its a text field when i call the data from the database, it calls the entire text box as a single option in my select list.. I want to break the words in the text field (at the comma) and have them listed each one as an option in the select list. Example what i need: Words in text box:(my input allows the "comma") word1, word2, word3, word4, word5, word6, How i want them called/displayed: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> here's my code: $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $original_functionsexperience =doSelectSql($query,1); $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $functionsexperiencelist=doSelectSql($query); $funcexpList ="<select multiple=\"multiple\" onchange=\"setFunctionsexperience(this.options)\">"; foreach ($functionsexperiencelist as $functionsexperienceal) { $selected=""; if ($functionsexperienceals->allwords == $original_functionsexperience) $selected=' selected="selected"'; $allwords=$functionsexperienceal->allwords; $funcexpList .= "<optgroup label=\"Current selection\"> <option value=\"".$allwords."\" ".$selected." >".$allwords."</option> </optgroup> <optgroup label=\"Existing Words\"> <option value=\"existing1,\">existing1</option> <option value=\"existing2,\">existing2</option> <option value=\"existing3,\">existing3</option> <option value=\"existing4,\">existing4</option> <option value=\"existing5,\">existing5</option> <option value=\"existing6,\">existing6</option> </optgroup> <optgroup label=\"Others added\"> //heres problem <option value=\"".$allwordsgeneral."\">".$allwordsgeneral."</option> </optgroup>"; } $funcexpList.="</select>"; $output['FUNCEXPLIST']=$funcexpList; The result im getting for optgroup others added: word1, word2, word3, word4, word5, how can i get it like this: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> Hi , I have one question .. Can I split showing of content of dynamic list in 2 parts , when I echo list in code .. Code: [Select] <?php // Run a select query to get my letest 8 items // Connect to the MySQL database include "../connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 8"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= '<table width="100%" border="2" cellspacing="2" cellpadding="2"> <tr> <td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="2" /></a></td> <td width="83%" valign="top">' . $product_name . '<br /> $' . $price . '<br /> <a href="product.php?id=' . $id . '">View Product Details</a></td> </tr> </table>'; } } else { $dynamicList = "We have no products listed in our store yet"; } mysql_close(); ?> Code: [Select] <p><?php echo $dynamicList; ?><br /> </p> It works ok, and putting my files, everything works, but when I put 8 pictures with price and other details, it just show one image with details and another image below with details, and the third image below and so on .. Can I split dynamic list to show 4 images with details on the left side and 4 on the right side? Thank you in advance for help , if is possible Hi, I use the following code to create a select menu from an array of options stored in LISTS.php: include 'LISTS.php'; print('<select id="from" name="from">'); foreach ($langList as $lang) {printf('<option %s>%s</option>', ($from1 == $lang ? 'selected="selected"' : ''), $lang); } echo '</select>'; where LISTS.php includes the following: $langList = array(' ','English', 'French', 'German', 'Dutch', 'Spanish'); This works great, but now I want to do something similar with a checkbox list, where each checkbox has an associated 'onchange' javascript function and I'm getting pretty stuck. My checkbox list is of the following form: Code: [Select] <html> <ul style="height: 95px; overflow: auto; width: 200px; border: 1px solid #480091; list-style-type: none; margin: 0; padding: 0;"> <li id="li1b"><label for="chk1b"><input name="chk1b" id="chk1b" type="checkbox" onchange="function1('chk1b','li1b')">Option1</label></li> <li id="li2b"><label for="chk2b"><input name="chk2b" id="chk2b" type="checkbox" onchange="function1('chk2b','li2b')">Option2</label></li> //etc. </ul> </html> What I want to do is have 'Option1', 'Option2', etc. stored in an array in LISTS.php and have a PHP script that populates the checkbox list accordingly, in a similar manner to my select menu above. I can't work out how to get the ID of the next <li> and the next <input> in the list to go up by one each time, e.g. 'li1b' then 'li2b', 'li3b', etc. Could someone pls help me out? Thanks! Is there a way to take data that is listed like a,b,c,d,e and turn that into an unordered list? Basically, I'm going to have a list of schools that will be listed with comma separators. I'll print that data out in two places, one will be printed as it's in the database. The other I would like to echo as an unordered list. How hard would something like this be? I have a database with all my users. I need an empty list and when a user clicks a button "Add me to the list" they are added to the first position in the list Slots 1. Tom 2. 3. 4. 5. Later, Jerry wants to be added to the list. So this happens Slots 1. Jerry 2. Tom 3. 4. 5. More people join the list 1. Bob 2. John 3. Jerry 4. Tom 5. Tom gets upset clicks the same button to join the list again, and he's bumped back up to first place. Slots 1. Tom 2. Bob 3. John 4. Jerry 5. Is this possible? And is so, how would I go about getting started on such a thing? I've been using PHP for about a year and a half. Hello there, this is a really noob question, but I've no idea on how to make it work without making everything messy and crappy. I have one SQL table called categories, and another called subcategories. Inside the subcategories table there's a field named 'parent' that will link it to the correspondent category, so it should look something like this in html: Code: [Select] <ul> <li>Category <ul> <li>Subcategory</li> </ul> </li> </ul> Would you please give this poor guy a hand? =) Is it possible to get bittorrent peer list (IP list) via php, udp protocol ? txh! Hey, I'm having a issue with using a listbox.. Am I doing something wrong?? Heres my HTML: Code: [Select] <select style="height:100px;width:250px;" name="countries[]" multiple> <option value="US">United States</option> <option value="UK">United Kingdom</option> <option value="CA">Canada</option> <option value="AU">Australia</option> </select> and my PHP: $countries = $_POST['countries']; $countries = implode(' | ', $countries); I'm trying to set it up so I can insert the data as: US | UK | CA. But, when I submit the form, I get these errors: Quote Notice: Undefined index: countries in /Applications/MAMP/htdocs/mynewscript/admin/cp/add.php on line 30 Warning: implode() [function.implode]: Invalid arguments passed in /Applications/MAMP/htdocs/mynewscript/admin/cp/add.php on line 31 Thanks in advance! Hi , i am trying to make a to do list where i can add things i still need to do . i also want to remove items from the list when they are done , this is what i made now but it still misses a lot , my array keeps getting emptied when i add something.
im still a beginner in php. This is the file without the css included , i don't think it's relevant to this question to include it.
<?php How can I edit this code to have images appear in it? <div id="rssSummaryList<?php echo intval($bID)?>" class="rssSummaryList"> <?php if( strlen($title)>0 ){ ?> <div class="rssSummaryListTitle"><?php echo $title?></div> <?php } ?> <?php $rssObj=$controller; $textHelper = Loader::helper("text"); if (!$dateFormat) { $dateFormat = t('jS F, Y'); } if( strlen($errorMsg)>0 ){ echo $errorMsg; }else{ foreach($posts as $itemNumber=>$item) { if( intval($itemNumber) >= intval($rssObj->itemsToDisplay) ) break; ?> <div class="rssItem"> <div class="rssItemTitle"> <a href="<?php echo $item->get_permalink(); ?>" <?php if($rssObj->launchInNewWindow) echo 'target="_blank"' ?> > <?php echo substr ($item->get_title(), 0, 100); ?> </a> </div> <div class="rssItemDate"><?php echo $item->get_date($dateFormat); ?></div> <div class="rssItemSummary"> <?php if( $rssObj->showSummary ){ echo $item->get_description(); } ?> <a href="<?php echo $item->get_permalink(); ?>" <?php if($rssObj->launchInNewWindow) echo 'target="_blank"' ?> >Read more</a> </div> </div> <?php } } ?> </div> Hello, I am using the send mail form, everything is sent to my mail except the country field, it is sending blank. Code: [Select] $name = $_REQUEST['name'] ; $phone = $_REQUEST['phone'] ; $email = $_REQUEST['email'] ; $country = $_REQUEST['country'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail( $to, $subject, $name."\n".$phone."\n".$email."\n".$country."\n".$message, $headers); How could it be fixed please? thanks I am working on a podcast list script. It displays the results of my mysql query correctly, but shows the results in 1 long list. Code: [Select] $query3 = "SELECT * FROM podcasts WHERE show_id = $show_id ORDER BY airdate DESC"; $result3 = mysql_query($query3) or die(mysql_error()); I would like to further filter the results instead of 1 hugely long list. For example, view by year, month etc... The 'airdate' is stored in the database as DATETIME. Is there a way to seperate the parts of the date: year, month, day using php ?? And if so how would I go about displaying only the podcasts for a specific year or month etc. ?? website located at http://www.eliteweboffers.com/lwr/podcasts.php Thanks. |